:root {
  --red: #d1151a;
  --red-dark: #a80f14;
  --ink: #000000;
  --muted: #54595f;
  --line: #e6e9ec;
  --soft: #f9f9f9;
  --white: #ffffff;
  --ok: #2e7d32;
  --radius: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Roboto", system-ui, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--white);
}

main {
  flex: 1;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 8px 16px 48px;
}

a { color: var(--red); }

h1, h2, h3 {
  color: var(--ink);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.25;
}

h1 { font-size: 26px; margin: 28px 0 14px; }
h2 { font-size: 18px; margin: 28px 0 12px; }

p { margin: 8px 0; }
.lead { font-size: 18px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Шапка */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.nav-toggle { display: none; }

.header-top {
  max-width: 1140px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo { order: 1; }

.logo img {
  display: block;
  height: 34px;
  width: auto;
}

.main-nav {
  order: 2;
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 6px 22px;
}

.main-nav a {
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  text-transform: uppercase;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--red);
  border-bottom-color: var(--red);
}

.call {
  order: 3;
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--red);
  color: var(--white);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.call:hover { background: var(--red-dark); }

.call-short { display: none; }

.header-logout {
  order: 3;
  margin-left: auto;
}

@media (max-width: 1100px) {
  .header-logout {
    order: 2;
    margin-left: 0;
  }
}

@media (max-width: 600px) {
  .header-logout {
    margin-left: auto;
  }
}

.burger {
  display: none;
  order: 4;
  width: 44px;
  height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}

.burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--ink);
}

.sub-bar {
  background: var(--soft);
  border-top: 1px solid var(--line);
}

.sub-bar-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}

.sub-bar a {
  color: var(--ink);
  text-decoration: none;
}

.sub-bar a:hover { color: var(--red); }

.sub-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.sub-bar .btn {
  min-height: 44px;
  padding: 10px 16px;
}

/* Кнопки, карточки, формы */

.btn,
button {
  display: inline-block;
  padding: 12px 22px;
  border: 0;
  border-radius: var(--radius);
  background: var(--red);
  color: var(--white);
  font: 700 15px/1.2 "Roboto", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover,
button:hover { background: var(--red-dark); }

.btn-light {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--ink);
}

.btn-light:hover {
  background: var(--ink);
  color: var(--white);
}

.btn,
.btn-light {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

button[type="submit"] {
  min-height: 44px;
  box-sizing: border-box;
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

.card {
  display: block;
  margin: 12px 0;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.between { justify-content: space-between; }
.grow { flex: 1 1 180px; }

.group-row { align-items: flex-end; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 14px;
}

.section-head h1 { margin: 0; }

.section-head .btn { min-height: 44px; }

.section-head[data-order-head] {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
}

.section-head[data-order-head] .badge,
.section-head[data-booking-head] .badge {
  max-width: 100%;
  min-height: 44px;
  padding: 12px 22px;
  font: 700 15px/1.2 "Roboto", system-ui, sans-serif;
  letter-spacing: 0.3px;
  text-align: center;
  border-radius: var(--radius);
}

.section-head[data-order-head] .btn { margin-left: auto; }

.section-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 12px;
}

.section-row h2 { margin: 0; }

.section-row .btn { min-height: 44px; }

.line-row { display: flex; align-items: stretch; }

.line-row .line-link { flex: 1 1 auto; min-width: 0; }

.line-delete {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  text-decoration: none;
}

.line-delete:hover { color: var(--red); background: var(--soft); }

.item-remove {
  position: relative;
  flex: 0 0 32px;
  width: 32px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  text-decoration: none;
  border-radius: var(--radius);
}

.item-remove::before {
  content: "";
  position: absolute;
  inset: -8px -6px;
}

.item-remove:hover { color: var(--red); background: var(--soft); }

.booking-works-current {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -20px;
  padding: 0 20px 8px;
  max-height: 40vh;
  overflow-y: auto;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

@media (max-width: 720px) {
  .booking-works-current { margin: 0 -16px; padding: 0 16px 8px; }
}

.block-total { text-align: right; margin: 6px 0 0; }

.booking-works-meta { margin: 0 0 6px; }
.booking-works-current ul { list-style: none; margin: 0; padding: 0; }
.booking-works-current li { padding: 3px 0; }
.booking-works-current .added-list li { padding: 3px 0; }
.booking-works-current .block-total { margin: 4px 0 0; }
.booking-works-current h2 { margin: 6px 0 4px; font-size: 15px; }
#booking-services h2 { margin: 8px 0 4px; }
#booking-services > p.muted { margin: 0 0 6px; }

.order-total { margin-top: 16px; text-align: right; }

.order-total .total { font-size: 18px; }

.bottom-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.bottom-actions .erase-link { margin-left: auto; }

.order-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin: 0 0 16px; }

@media (max-width: 720px) { .order-actions > .btn { flex: 1 1 100%; } }

.transfer-phone { display: none; }

form:has(input[name=payment][value=phone]:checked) .transfer-phone { display: block; }

.group-add {
  flex: 0 0 44px;
  width: 44px;
  min-height: 44px;
  margin-bottom: 12px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

label {
  display: block;
  margin: 12px 0;
  font-size: 14px;
  color: var(--muted);
}

label > input,
label > select,
label > textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
}

input,
select,
textarea {
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #c4c9d0;
  border-radius: var(--radius);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--red);
  outline-offset: -1px;
  border-color: var(--red);
}

label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-size: 16px;
  color: var(--ink);
}

label.check > input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--red);
}

fieldset {
  margin: 12px 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

legend {
  padding: 0 6px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink);
}

.alert {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 4px solid var(--red);
  background: #fdeeee;
  border-radius: var(--radius);
  color: #5a0d10;
}

.notice {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 4px solid var(--ink);
  background: var(--soft);
  border-radius: var(--radius);
}

/* Вход */

.auth {
  max-width: 460px;
  margin: 16px auto 0;
}

.auth-form {
  margin-top: 16px;
  padding: 20px;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: var(--radius);
}

.code-input {
  font-size: 28px;
  letter-spacing: 12px;
  text-align: center;
}

.dev-box {
  max-width: 460px;
  margin: 24px auto;
  padding: 14px;
  background: var(--soft);
  border-radius: var(--radius);
}

/* Запись */

.steps {
  display: flex;
  gap: 8px;
  margin: 12px 0 8px;
  padding: 0;
  list-style: none;
}

.steps li {
  flex: 1;
  padding-top: 8px;
  border-top: 3px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  text-transform: uppercase;
}

.steps li.current {
  color: var(--red);
  border-top-color: var(--red);
  font-weight: 700;
}

.steps li.done {
  color: var(--ink);
  border-top-color: var(--ink);
}

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.slot {
  display: block;
  padding: 12px 8px;
  text-align: center;
  font-weight: 700;
  color: var(--red);
  background: var(--white);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  text-decoration: none;
}

.slot:hover {
  background: var(--red);
  color: var(--white);
}

/* Таблицы */

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--line);
}

th {
  padding: 10px 12px;
  background: var(--ink);
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  text-transform: uppercase;
}

td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

tr:hover td { background: var(--soft); }

tr[data-row-modal] { cursor: pointer; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-open {
  background: #ffd600;
  border-color: #ffd600;
  color: #000;
}

.badge-closed {
  background: #2e7d32;
  border-color: #2e7d32;
  color: #fff;
}

.badge-confirmed {
  background: #1b5e20;
  border-color: #1b5e20;
  color: #fff;
}

.badge-scheduled { color: var(--ink); }

.badge-in_progress {
  background: #fb8c00;
  border-color: #fb8c00;
  color: #000;
}

.badge-done {
  color: var(--ok);
  border-color: var(--ok);
}

.badge-cancelled {
  background: #6d4c41;
  border-color: #6d4c41;
  color: #fff;
}

.badge-unpaid {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

.badge-partly {
  background: #fb8c00;
  border-color: #fb8c00;
  color: #000;
}

.badge-paid {
  background: #2e7d32;
  border-color: #2e7d32;
  color: #fff;
}

.badge-overdue {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

.line-card { padding: 0; margin: 6px 0; }

.line-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 12px;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius);
}

a.line-link:hover { background: var(--soft); }

.line-detail { display: block; }

.line-sum { white-space: nowrap; }

.line-actions { margin: 0; padding: 0 16px 12px; }

[hidden] { display: none !important; }

.picker-search { width: 100%; margin: 8px 0 12px; }

.picker-search-row { display: flex; gap: 8px; align-items: center; margin: 8px 0 12px; }

.picker-search-row .picker-search { flex: 1 1 auto; width: auto; min-width: 0; margin: 0; }

.picker-add-plus { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.block-actions { display: flex; justify-content: flex-end; margin: 8px 0 16px; }

.order-status-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.order-status-form select { width: auto; min-height: 44px; }

.status-save { min-height: 44px; }

.car-delete-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }

.car-delete-row > * { flex: 1 1 0; text-align: center; }

.picker-group {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.picker-group > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  color: var(--red);
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.picker-group > summary::-webkit-details-marker { display: none; }

.picker-group[open] > summary { border-bottom: 1px solid var(--line); }

.picker-item {
  margin: 0;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.picker-group > .picker-item:first-of-type { border-top: 0; }

.picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.picker-row .picker-text {
  flex: 1;
  min-width: 0;
}

.picker-check {
  display: none;
}

.picker-plus {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 2px solid var(--red);
  border-radius: var(--radius);
  background: var(--red);
  color: var(--white);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.picker-plus.is-on {
  background: var(--white);
  color: var(--red);
}

.picker-item.is-chosen {
  background: #fff5f5;
}

.picker-editor {
  flex: 1;
  min-width: 0;
}

.picker-editor-fields {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px 14px;
  width: 100%;
}

.picker-editor-fields label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  white-space: nowrap;
}

.picker-editor-fields input {
  flex: none;
  width: 90px;
  height: 44px;
}

.picker-editor-fields input[data-field="price"] {
  width: 100px;
}

.picker-editor-fields .dd {
  flex: none;
  width: 300px;
}

.picker-editor .dd-list {
  right: auto;
  min-width: 280px;
  width: max-content;
  max-width: min(420px, 92vw);
}

.picker-editor-fields .dd-button {
  height: 44px;
}

.picker-editor-fields label:nth-child(2) {
  margin-left: auto;
}

.picker-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.picker-cancel {
  display: none;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 2px solid var(--red);
  border-radius: var(--radius);
  background: var(--red);
  color: var(--white);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.picker-item.is-editing .picker-cancel,
.staged-remove {
  display: block;
}

.picker-item.is-editing {
  background: #fff;
  box-shadow: inset 4px 0 0 var(--red);
}

.picker-item.is-editing .picker-row {
  align-items: center;
  height: 44px;
}

@media (max-width: 720px) {
  .picker-item.is-editing .picker-row {
    height: auto;
  }
}

.picker-item.is-editing .picker-text {
  display: none;
}

.added-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
}

.added-list li {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 1100px) and (min-width: 721px) {
  .picker-editor-fields .dd {
    width: 220px;
  }
}

@media (max-width: 720px) {
  .picker-editor-fields {
    flex-wrap: wrap;
  }

  .picker-editor-fields label {
    flex: 1 1 100%;
    flex-direction: column;
    align-items: stretch;
    white-space: normal;
  }

  .picker-editor-fields .dd {
    width: 100%;
  }

  .picker-editor-fields input {
    width: 100%;
  }
}

.picker-subgroup {
  margin: 6px 8px 8px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.picker-subgroup > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.picker-subgroup > summary::-webkit-details-marker { display: none; }

.picker-subgroup[open] > summary { border-bottom: 1px solid var(--line); }

.picker-subgroup .picker-item {
  padding-left: 30px;
  font-size: 15px;
}

.picker-subgroup .picker-item .muted,
.picker-subgroup .picker-item .small {
  font-size: 13px;
}

@media (max-width: 720px) {
  .picker-subgroup { margin-left: 14px; }
  .picker-subgroup .picker-item { padding-left: 24px; }
}

.dd {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 4px;
}

.dd-native { display: none !important; }

.dd-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  font-weight: 400;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #c4c9d0;
  border-radius: var(--radius);
  cursor: pointer;
}

.dd-button:hover { background: var(--white); }

.dd-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dd-button::after {
  content: "▾";
  color: var(--muted);
}

.dd.open .dd-button { border-color: var(--red); }

.dd-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 280px;
  margin: 4px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.dd.open .dd-list { display: block; }

.dd.dd-up .dd-list {
  top: auto;
  bottom: 100%;
  margin: 0 0 4px;
}

.dd-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  cursor: pointer;
}

.dd-option:hover { background: var(--soft); }

.dd-option.dd-selected {
  color: var(--red);
  font-weight: 600;
}

.dd-mark {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 1px solid var(--ink);
  border-radius: 3px;
}

.dd-single .dd-mark { border-radius: 50%; }

.dd-option.dd-selected .dd-mark {
  background: var(--red);
  border-color: var(--red);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.tabs a.active {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

.desktop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 130px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  font-weight: 700;
}

.tile:hover { border-color: var(--red); }

.tile-icon svg {
  display: block;
  width: 44px;
  height: 44px;
  color: var(--red);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.weekday {
  width: 40px;
  font-weight: 700;
}

.journal-filters {
  flex-wrap: wrap;
}

.log {
  list-style: none;
  padding: 0;
}

.log li {
  margin: 6px 0;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

code {
  padding: 2px 6px;
  background: var(--soft);
  border-radius: 3px;
}

/* Подвал */

.site-footer {
  margin-top: 40px;
  background: var(--ink);
  color: #c9ccd1;
  font-size: 14px;
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.footer-inner strong {
  color: var(--white);
  text-transform: uppercase;
}

.footer-inner p { margin: 6px 0; }

.site-footer a {
  color: var(--white);
  text-decoration: none;
}

.site-footer a:hover { color: var(--red); }

.copy {
  padding: 12px 16px;
  border-top: 1px solid #2a2d33;
  text-align: center;
  font-size: 13px;
  color: #8a8f96;
}

/* Адаптация: планшет и телефон */

@media (max-width: 1100px) {
  .header-top {
    flex-wrap: wrap;
    gap: 10px 14px;
  }

  .call {
    order: 2;
    margin-left: auto;
  }

  .burger {
    display: flex;
    order: 3;
  }

  .main-nav {
    display: none;
    order: 4;
    width: 100%;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--line);
  }

  .nav-toggle:checked ~ .header-top .main-nav { display: flex; }

  .main-nav a {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .main-nav a.active { border-bottom-color: var(--line); }
}

@media (max-width: 900px) {
  .table-wrap { overflow: visible; }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  table {
    background: none;
    border: 0;
  }

  thead { display: none; }

  tr {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  tr:hover td { background: none; }

  td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border: 0;
    text-align: right;
  }

  td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    text-align: left;
  }
}

@media (max-width: 720px) {
  main { padding: 8px 14px 40px; }

  h1 { font-size: 22px; }

  button,
  .btn,
  .slot,
  .call { min-height: 44px; }

  input:not([type="checkbox"]),
  select,
  textarea { min-height: 44px; }

  label.check {
    min-height: 44px;
    align-items: center;
  }

  .code-input {
    font-size: 24px;
    letter-spacing: 8px;
  }
}

/* Всплывающее окно и выпадающие списки с поиском */

.modal {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
}

.modal.open { display: flex; }

body.modal-open { overflow: hidden; }

.modal-box {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow: hidden;
  padding: 0;
  background: var(--white);
  border-top: 4px solid var(--red);
  border-radius: var(--radius);
}

#modal-head,
#modal-foot {
  flex: none;
}

#modal-head:empty,
#modal-foot:empty {
  display: none;
}

#modal-head {
  padding: 20px 20px 0;
}

#modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 20px 20px;
}

#modal-head:empty + #modal-body {
  padding-top: 20px;
}

#modal-head > h1 {
  margin-top: 0;
  padding-top: 4px;
}

#modal-head > .section-head {
  margin: 0 0 14px;
  padding: 4px 52px 0 0;
}

#modal-head .section-head h1 {
  margin: 0;
}

#modal-head > .booking-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 10px;
  padding: 4px 0 0;
}

#modal-head > .booking-top h1 {
  padding-right: 0;
}

#modal-foot {
  padding: 12px 20px 20px;
  border-top: 1px solid var(--line);
}

#modal-foot > .modal-foot {
  margin-top: 0;
}

.modal-box h1 {
  margin-top: 4px;
  padding-right: 40px;
  font-size: 22px;
}

.modal-box h2 { margin-top: 4px; }

.modal-close {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 5;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.modal-close:hover {
  background: none;
  color: var(--red);
}

.combo { position: relative; }

.combo-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 240px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.combo.open .combo-list { display: block; }

.combo-list li {
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  cursor: pointer;
}

.combo-list li:hover,
.combo-list li.active {
  background: var(--soft);
  color: var(--red);
}

.combo-list li .desc {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.combo-list li.hint,
.combo-list li.hint:hover {
  background: none;
  color: var(--muted);
  font-size: 14px;
  cursor: default;
}

input[name="plate"],
input[name="vin"] { text-transform: uppercase; }

@media (max-width: 720px) {
  .modal { padding: 0; }

  .modal-box {
    max-width: none;
    max-height: none;
    height: 100%;
    padding: 0;
    border-top: 0;
    border-radius: 0;
  }

  #modal-head {
    padding: 16px 16px 0;
  }

  #modal-body {
    padding: 0 16px 16px;
  }

  #modal-head:empty + #modal-body {
    padding-top: 16px;
  }

  #modal-foot {
    padding: 12px 16px 16px;
  }

  #modal-foot .modal-foot > * {
    white-space: nowrap;
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (min-width: 721px) {
  .modal-box { max-width: 960px; }
  .modal-box:has(.booking-view) { max-width: 1160px; }
  .modal-box:has(#client-form) { max-width: 760px; }
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.modal-actions > * {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
}

@media (max-width: 720px) {
  .modal-actions { flex-direction: column; }
  .modal-actions > * { flex: 0 0 auto; width: 100%; }
  .modal-foot { flex-direction: row; }
  .modal-foot > * { flex: 1 1 0; width: auto; }
}

.booking-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-right: 44px;
}

.booking-head h1 { margin: 0; padding-right: 0; }

.booking-grid { display: grid; gap: 0 16px; }

.booking-line {
  cursor: pointer;
  margin: 0 -6px;
  padding: 4px 6px;
  border-radius: 6px;
}

.booking-line:hover { background: var(--soft); }

.works-open { cursor: pointer; }

.works-open:hover { background: var(--soft); }

.order-open { cursor: pointer; margin: 0 -6px; padding: 4px 6px; border-radius: 6px; }

.order-open:hover { background: var(--soft); }

.order-head { line-height: 1.3; }

.order-head p { margin: 2px 0; }

.order-head .order-open { padding: 2px 6px; }

.order-head .order-hint { margin: 0; }

.order-head { padding-bottom: 10px; }

.overdue-row td { background: #fff5f3; }

.overdue-card { border-left: 4px solid var(--red); }

.group-head th { text-align: left; font-size: 15px; padding-top: 16px; }
.group-empty td { color: var(--muted); }

.badge-small { margin-left: 6px; padding: 1px 6px; font-size: 11px; vertical-align: middle; }

.search-row { display: flex; align-items: flex-end; gap: 12px; margin-top: 12px; }
.search-row label { flex: 1 1 auto; margin: 0; }
.search-row label input { height: 44px; margin-top: 0; box-sizing: border-box; }
.search-row .btn { height: 44px; display: inline-flex; align-items: center; justify-content: center; padding-top: 0; padding-bottom: 0; box-sizing: border-box; flex: 0 0 auto; }

.date-filter { margin: 12px 0; }
.date-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.date-fields label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; color: var(--muted); }
.date-fields input { width: 150px; height: 44px; margin: 0; box-sizing: border-box; }
.date-fields .btn, .date-fields .btn-light { height: 44px; display: inline-flex; align-items: center; justify-content: center; padding-top: 0; padding-bottom: 0; box-sizing: border-box; }
.toolbar > .date-fields { margin: 0 auto; }
.section-head[data-toolbar] > .date-fields { margin: 0 auto; }
.booking-toolbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.booking-toolbar > .row { justify-self: start; }
.booking-toolbar > .date-fields { justify-self: center; margin: 0; }
.booking-toolbar > .btn { justify-self: end; }
@media (max-width: 1100px) {
  .booking-toolbar { grid-template-columns: minmax(0, 1fr); }
  .booking-toolbar > .row, .booking-toolbar > .date-fields { justify-self: stretch; }
  .booking-toolbar > .btn { justify-self: end; }
}
.orders-toolbar { margin: 12px 0; }
.toolbar + .date-filter-hint { margin-top: 10px; }
.summary-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 14px 0 18px; }
.summary-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: var(--radius); }
.summary-stat span { font-size: 13px; color: var(--muted); text-transform: uppercase; }
.summary-stat strong { font-size: 26px; line-height: 1.1; }
.summary-stat small { font-size: 13px; color: var(--muted); }
.summary-stat.stat-planned { border-top-color: #1e88e5; }
.summary-stat.stat-in_progress { border-top-color: #fb8c00; }
.summary-stat.stat-awaiting { border-top-color: #2e7d32; }
.summary-stat.stat-done { border-top-color: #1b5e20; }
.summary-stat.stat-cancelled { border-top-color: #9e9e9e; }
.summary-stat.stat-overdue { border-top-color: var(--red); }

.booking-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin: 8px 0 18px;
}

.booking-card {
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.booking-card.st-scheduled { border-top-color: #1e88e5; }
.booking-card.st-in_progress { border-top-color: #fb8c00; }
.booking-card.st-done { border-top-color: #1b5e20; }
.booking-card.st-cancelled { border-top-color: #9e9e9e; }
.booking-card.is-late { box-shadow: inset 0 0 0 1px var(--red); }

.booking-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.booking-card p {
  margin: 4px 0 0;
}

.overdue-text {
  color: var(--red);
  font-weight: 700;
}
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 8px 0 22px; }
main:has(> .order-grid) { max-width: 1240px; }
.overdue-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 8px 0 18px; }
.overdue-grid > .card { margin: 0; }
@media (max-width: 720px) { .overdue-grid { grid-template-columns: minmax(0, 1fr); } }
.order-card { display: flex; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--radius); }
.order-card.st-open { border-left-color: #ffd600; }
.order-card.st-closed { border-left-color: #2e7d32; }
.order-card.st-confirmed { border-left-color: #1b5e20; }
.order-link { flex: 1 1 auto; min-width: 0; padding: 12px 14px; color: var(--ink); text-decoration: none; }
.order-link:hover { background: var(--soft); }
.order-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.order-card-top strong { margin-right: 6px; }
.order-card-total { font-size: 18px; font-weight: 700; white-space: nowrap; }
.order-card-client { margin: 6px 0 0; font-weight: 600; }
.order-card-meta { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.order-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.order-chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); color: var(--muted); }
.booking-pick { align-items: flex-start; }
.combo-list li.hint.add {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--red);
  font-weight: 700;
}

#car-add { display: none !important; }

.dd-option[data-value="__add__"] {
  color: var(--red);
  font-weight: 700;
}

.dd-option[data-value="__add__"] .dd-mark {
  display: none;
}

.dd-option[data-value="__add__"]::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  margin-right: 10px;
  border-radius: var(--radius);
  background: var(--red);
  color: var(--white);
  font-size: 18px;
  line-height: 1;
}

.combo-list .client-add-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--red);
  color: var(--white);
  font-size: 26px;
  line-height: 1;
}
.quick-panel { margin: 4px 0 14px; padding: 14px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); }
.quick-panel h3 { margin: 0 0 10px; font-size: 16px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 10px; }
.quick-grid label { margin: 0; }
.booking-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0 16px; }
.booking-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--red); border-radius: var(--radius); }
.booking-stat span { font-size: 13px; color: var(--muted); text-transform: uppercase; }
.booking-stat strong { font-size: 20px; line-height: 1.2; }
.booking-stat small { font-size: 13px; color: var(--muted); }
.booking-view .booking-stats {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -20px 12px;
  padding: 10px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

@media (max-width: 720px) {
  .booking-view .booking-stats { margin: 0 -16px 12px; padding: 10px 16px; }
}
.booking-view .booking-stat { padding: 10px 12px; }
.booking-view .form-note { margin: 0 0 4px; font-size: 13px; }
.push-right { margin-left: auto; }

.compact .tabs a { padding: 0 12px; }
.compact .date-fields { gap: 6px; }
.compact .date-fields input { width: 130px; }
.compact .date-fields .btn, .compact .date-fields .btn-light { padding-left: 14px; padding-right: 14px; }
.row > h2 { margin: 12px 0; }

.cars-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 12px 0; }
.car-tile { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.car-photo { display: flex; align-items: center; justify-content: center; height: 120px; background: var(--soft); }
.car-photo svg { width: 96px; height: 48px; fill: #9aa1ab; }
.car-photo circle { fill: #4a4f57; }
.car-body { flex: 1 1 auto; padding: 12px 14px 4px; }
.car-name { display: block; font-size: 16px; }
.car-body p { margin: 4px 0; }
.car-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px 14px; }
.car-actions .btn, .car-actions .btn-light { flex: 1 1 auto; text-align: center; }
.date-filter-hint { margin: 0 0 8px; }

.bookings-table { background: none; border: 0; }
.bookings-table thead th { background: var(--soft); color: var(--muted); padding: 6px 8px; font-size: 12px; font-weight: 500; }
.bookings-table td { padding: 6px 8px; font-size: 14px; }
.bookings-table .group-head th { background: none; color: var(--ink); text-transform: none; font-size: 15px; font-weight: 700; padding: 14px 8px 6px; border-bottom: 2px solid var(--line); }
.bookings-table .group-empty td { color: var(--muted); padding: 6px 8px; }

@media (max-width: 900px) {
  .bookings-table .group-head { display: block; margin: 16px 0 6px; background: none; border: 0; padding: 0; }
  .bookings-table .group-head th { display: block; padding: 0; background: none; color: var(--ink); text-transform: none; font-size: 15px; font-weight: 700; border: 0; }
  .bookings-table .group-empty { display: block; margin: 0 0 8px; padding: 0; background: none; border: 0; }
  .bookings-table .group-empty td { display: block; padding: 0; border: 0; }
}

.booking-view .card { margin: 0 0 10px; padding: 10px 12px; }
.booking-view .card h2 { margin: 0; font-size: 16px; }
.booking-view .section-row { margin: 0 0 8px; }
.booking-view .booking-grid { margin: 0; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.compact-form { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.compact-form label { margin: 0 0 6px; font-size: 13px; }
.compact-form input, .compact-form select, .compact-form textarea { padding: 7px 10px; }
.compact-form .wide { grid-column: 1 / -1; }
.works-compact { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.works-compact li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.works-compact li:last-child { border-bottom: 0; }
.history { margin-top: 12px; }
.history summary { cursor: pointer; font-weight: 500; padding: 6px 0; }
.compact-form > label:nth-child(4) { grid-column: span 2; }
@media (max-width: 720px) { .compact-form { grid-template-columns: 1fr; } .compact-form > label:nth-child(4) { grid-column: auto; } }

.plate { display: inline-flex; align-items: stretch; vertical-align: baseline; background: #fff; color: #000; border: 2px solid #000; border-radius: 5px; font-family: "Arial Narrow", "Liberation Sans Narrow", Arial, sans-serif; font-weight: 700; font-size: 1.15em; line-height: 1; white-space: nowrap; overflow: hidden; }
.plate-main { padding: 0.17em 0.25em; letter-spacing: 0.02em; text-box: trim-both cap alphabetic; }
.plate-region { padding: 0.17em 0.2em; border-left: 2px solid #000; letter-spacing: 0.02em; text-box: trim-both cap alphabetic; }

.req { color: var(--red); font-weight: 700; margin: 0 0.15em; }
.form-note { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.field-caption { margin: 0 0 6px; font-weight: 500; }
.field-error-text { margin: 6px 0 0; color: var(--red); font-size: 14px; font-weight: 500; }
input.field-error, select.field-error, textarea.field-error, .dd.field-error .dd-button { border-color: var(--red) !important; background-color: #fff5f5; }
.picker.field-error, fieldset.field-error { outline: 2px solid var(--red); outline-offset: 4px; }

.invoice-button { display: none; }

.close-form:has(.legal-toggle:checked) .invoice-button { display: inline-block; }

.booking-log {
  max-height: 240px;
  overflow-y: auto;
  padding-right: 6px;
}

.booking-log,
.booking-log .log,
.booking-log .log li {
  font-size: 12px;
  line-height: 1.35;
}

@media (min-width: 900px) {
  .booking-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; }
}

@media (max-width: 480px) {
  .logo img { height: 28px; }

  .call {
    padding: 8px 12px;
    font-size: 14px;
  }

  .call-num { display: none; }

  .call-short { display: inline; }
}
