:root {
  --blue: #1f74bd; --blue-d: #0e3a66; --blue-50: #eaf3fc; --blue-100: #d4e6f8;
  --bg: #eef1f5; --panel: #fff; --soft: #f2f4f7; --line: #e2e7ee; --line-2: #d3dae4;
  --text: #18202b; --muted: #687587; --faint: #9aa5b4;
  --red: #d33b3b; --green: #23935a; --amber: #c98a00;
  --r: 16px; --r-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
code { background: var(--soft); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }
.ico { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; letter-spacing: .3px; }
.spacer { flex: 1; }
.mt { margin-top: 14px; }
.upper { text-transform: uppercase; }
.upper::placeholder { text-transform: none; }
.list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 18px 14px; background: var(--panel); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; color: var(--blue-d); font-weight: 800; font-size: 16px; letter-spacing: .4px; text-transform: uppercase; }
.brand:hover { text-decoration: none; }
.brand img { width: 46px; height: 46px; object-fit: contain; flex: none; }
.brand-name { line-height: 1.15; overflow-wrap: anywhere; }
.brand.has-logo { flex-direction: column; text-align: center; gap: 6px; }
.brand.has-logo img { width: auto; height: auto; max-width: 100%; max-height: 96px; }
.nav, .side-foot { display: flex; flex-direction: column; gap: 8px; }
.nav a, .side-foot > a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; background: var(--soft); color: var(--text); font-weight: 700; font-size: 14px; letter-spacing: .5px; text-transform: uppercase; }
.nav a:hover, .side-foot > a:hover { background: #e6eaf0; text-decoration: none; }
.nav a .ico, .side-foot > a .ico { color: var(--muted); }
.nav a.on, .side-foot > a.on { background: var(--blue); color: #fff; }
.nav a.on .ico, .side-foot > a.on .ico { color: #fff; }
.side-foot { margin-top: auto; }
.me { display: flex; align-items: center; gap: 6px; padding: 4px 4px 0 8px; color: var(--muted); font-size: 13px; }
.me span { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .ico { width: 18px; height: 18px; }
.main { padding: 22px 28px 48px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; min-height: 42px; }
.page-head .back { font-size: 24px; font-weight: 700; color: var(--text); }
.page-head .arrow { font-size: 22px; color: var(--muted); }
.sec { margin: 28px 0 12px; font-size: 18px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sec-head h3 { margin: 0; }
.sub-h { margin: 18px 0 4px; font-weight: 700; font-size: 14px; }
.form-h { margin: 0 0 12px; }
.newcar .form-h { margin-top: 4px; }
.newcar > .form-h { margin-top: 22px; }

/* ---------- карточки, кнопки, сообщения ---------- */
.card { background: var(--panel); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.card h3 { margin-bottom: 12px; }
.card .sec-head h3 { margin-bottom: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; min-height: 40px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b4bfcd; text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #1a65a6; }
.btn.danger { color: var(--red); }
.btn.small { padding: 5px 11px; min-height: 32px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn .ico { width: 18px; height: 18px; }
.btn.big { padding: 16px 26px; font-size: 19px; border-radius: 14px; background: var(--soft); border: 0; min-height: 58px; }
.btn.big:hover { background: #e5e9ef; }
.btn.big .ico { width: 22px; height: 22px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--soft); color: var(--text); text-decoration: none; }
.icon-btn.wa:hover { color: #1fa855; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.actions form { margin: 0; }
.flash { background: #e8f6ee; color: #17623c; border: 1px solid #bfe5cf; padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; }
.error { background: #fdecec; color: #9b2323; border: 1px solid #f4c4c4; padding: 10px 14px; border-radius: 12px; }
.subnote { background: #fff6df; color: #6f4a00; border: 1px solid #f0d89a; padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; }
.subnote.bad { background: #fdecec; color: #9b2323; border-color: #f4c4c4; }
.access { font-family: Consolas, "Cascadia Mono", monospace; min-height: 170px; }
.tbl-wrap { overflow-x: auto; }
.empty-state { color: var(--muted); text-align: center; padding: 30px 16px; }
.big-empty { padding: 60px 20px; }
.big-empty .ico { width: 56px; height: 56px; color: var(--faint); }
.big-empty h3 { margin: 12px 0 8px; color: var(--text); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.blue { background: var(--blue-50); color: var(--blue); }
.badge.green { background: #e3f5ea; color: #17623c; }
.badge.red { background: #fdecec; color: #9b2323; }
.plate { display: inline-block; border: 1.5px solid #20242b; border-radius: 5px; padding: 0 6px; font-weight: 700; font-size: 13px; letter-spacing: 1px; background: #fff; color: #111; font-family: Consolas, "Segoe UI", monospace; line-height: 1.45; }
.plate.big { font-size: 17px; padding: 1px 9px; }

/* ---------- формы ---------- */
input, select, textarea { width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 12px; min-height: 40px; }
textarea { resize: vertical; min-height: 70px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; vertical-align: middle; accent-color: var(--blue); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 116, 189, .15); }
select:disabled { background: var(--soft); color: var(--faint); }
label, .fld { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
label > input, label > select, label > textarea, .fld > .sel { margin-top: 6px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); font-size: 14px; }
label.check input { width: 18px; height: 18px; min-height: 0; margin: 0; }
label.btn { font-size: 15px; color: var(--text); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.self-end { align-self: end; padding-bottom: 10px; }
.sel { display: flex; gap: 6px; }
.sel select { flex: 1; min-width: 0; }
.plus { flex: none; width: 40px; min-height: 40px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--blue-50); color: var(--blue); font-size: 22px; line-height: 1; cursor: pointer; padding: 0; }
.plus:hover { background: var(--blue-100); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.span2 { grid-column: span 2; }
.hint { font-size: 12.5px; font-weight: 500; color: var(--amber); margin-top: 4px; }
.hint:empty { display: none; }
.hint.ok { color: var(--green); align-self: end; padding-bottom: 10px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.pad { padding: 8px; gap: 8px; }
.search { position: relative; display: block; }
.search > .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { padding-left: 42px; }

/* ---------- главная ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 18px; align-items: start; }
.dash-wide { grid-column: 1 / -1; }
.dash-wide .sec { margin-top: 8px; }
.dash-brand { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; min-height: 420px; }
.dash-logo { max-width: min(380px, 100%); max-height: 260px; object-fit: contain; }
.dash-ph { width: 110px; height: 110px; }
.big-name { font-size: 40px; font-weight: 800; color: var(--blue-d); letter-spacing: 1.5px; text-transform: uppercase; line-height: 1.1; }
.today { color: var(--muted); font-size: 15px; }
.dash-search { width: min(520px, 100%); }
.dash-search input { min-height: 48px; border-radius: 14px; }
.dash .actions { margin-top: 0; }
.stats { display: flex; gap: 28px; margin-top: 6px; }
.stats div { display: flex; flex-direction: column; align-items: center; }
.stats b { font-size: 26px; color: var(--blue-d); }
.stats span { font-size: 13px; color: var(--muted); }
.cal { padding: 0; overflow: hidden; }
.cal-head { background: var(--blue); padding: 10px 0 0 18px; display: flex; flex-direction: column; align-items: flex-end; }
.cal-year { font-size: 30px; font-weight: 800; color: #0b1b2e; line-height: 1.1; padding-right: 18px; letter-spacing: 1px; }
.cal-month { align-self: stretch; margin: 8px 0 0 70px; background: var(--blue-d); color: #fff; border-radius: 26px 0 0 0; padding: 10px 18px; display: flex; align-items: center; justify-content: space-between; }
.cal-month b { font-size: 24px; text-transform: uppercase; letter-spacing: 1.5px; }
.cal-month a { color: #fff; font-size: 26px; line-height: 1; padding: 0 10px; border-radius: 8px; }
.cal-month a:hover { background: rgba(255, 255, 255, .15); text-decoration: none; }
.cal-body { background: #e8ebee; padding: 12px 14px 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-weight: 700; color: var(--blue-d); font-size: 16px; padding: 4px 0 6px; }
.cal-wd.we { color: var(--red); }
.cal-day { position: relative; display: flex; align-items: center; justify-content: center; height: 44px; border-radius: 10px; font-weight: 700; font-size: 18px; color: #15191f; }
.cal-day:hover { background: #fff; text-decoration: none; }
.cal-day.we { color: var(--red); }
.cal-day.out { color: #b3bbc6; font-weight: 500; }
.cal-day.today { background: #fff; box-shadow: inset 0 0 0 2px var(--blue); }
.cal-dot { position: absolute; top: 3px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--blue); color: #fff; font-size: 10.5px; line-height: 17px; text-align: center; }
.cal-foot { height: 16px; background: var(--blue); }

/* ---------- гараж ---------- */
.hub { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.hub-search { flex: 1; min-width: 280px; }
.hub-search input { min-height: 58px; border-radius: 14px; font-size: 16px; }
.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.mini { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 14px 16px; color: var(--text); box-shadow: var(--shadow); min-width: 0; }
a.mini:hover { border-color: var(--blue); text-decoration: none; }
.mini-phone { color: var(--muted); font-size: 15px; letter-spacing: .3px; }
.mini-img { width: 100%; height: 112px; display: flex; align-items: center; justify-content: center; margin: 4px 0 6px; }
.mini-img img { max-width: 100%; max-height: 112px; border-radius: 10px; object-fit: cover; }
.mini-img .carfront { width: 128px; height: 96px; color: #111; }
.mini-title { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.mini-sub { color: var(--muted); font-size: 13px; }
.mini-vin { color: var(--muted); font-size: 12px; letter-spacing: .5px; overflow-wrap: anywhere; }
.mini-vin .plate { font-size: 11.5px; }
.filters { display: grid; grid-template-columns: 2fr 1.3fr 1fr 1fr; gap: 10px; margin-bottom: 14px; padding: 14px; }
.count { margin: 0 4px 10px; }
.carlist { display: flex; flex-direction: column; gap: 12px; }
.carrow { display: grid; grid-template-columns: 116px minmax(0, 1fr) auto; gap: 18px; align-items: center; background: var(--panel); border: 1.5px solid var(--line-2); border-radius: 20px; padding: 12px 14px 12px 18px; }
.carrow:hover { border-color: var(--blue); }
.carrow-img { display: flex; align-items: center; justify-content: center; height: 80px; color: #111; }
.carrow-img img { max-width: 116px; max-height: 80px; border-radius: 10px; object-fit: cover; }
.carrow-img .carfront { width: 100px; height: 75px; }
.carrow-main { color: var(--text); min-width: 0; }
.carrow-main:hover { text-decoration: none; }
.carrow-title { font-weight: 700; font-size: 16.5px; text-transform: uppercase; letter-spacing: .3px; }
.carrow-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.carrow-sub .vin { font-family: Consolas, monospace; font-size: 12.5px; }
.carrow-client { margin-top: 5px; font-size: 15px; display: flex; gap: 14px; flex-wrap: wrap; }
.carrow-act { display: flex; align-items: center; gap: 2px; align-self: start; }
.star { border: 0; background: none; cursor: pointer; color: #c7ced8; padding: 6px; border-radius: 9px; display: inline-flex; }
.star:hover { background: var(--soft); }
.star .ico { width: 22px; height: 22px; }
.star.on { color: #f5a623; }
.star.on .ico { fill: #f5a623; }
.dots { position: relative; }
.dots summary { list-style: none; cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 9px; color: var(--muted); }
.dots summary::-webkit-details-marker { display: none; }
.dots summary:hover, .dots[open] summary { background: var(--soft); color: var(--text); }
.dots .menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); padding: 6px; text-align: left; }
.menu.wide-menu { min-width: 250px; }
.menu > a, .menu > form > button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; font: inherit; color: var(--text); border-radius: 9px; cursor: pointer; font-weight: 600; }
.menu > a:hover, .menu > form > button:hover { background: var(--soft); text-decoration: none; }
.menu .danger { color: var(--red); }
.menu .ico { width: 18px; height: 18px; }
.menu form { margin: 0; }

/* ---------- новый автомобиль ---------- */
.newcar-head { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; }
.photo-drop { position: relative; display: flex; align-items: center; justify-content: center; height: 200px; border: 2px dashed var(--line-2); border-radius: var(--r); cursor: pointer; overflow: hidden; background: var(--soft); }
.photo-drop:hover { border-color: var(--blue); }
.photo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.photo-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-drop .ph { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.photo-drop .ph > span { display: flex; align-items: center; gap: 6px; }
.photo-drop .carfront { width: 120px; height: 90px; color: #111; }
.photo-drop.has .ph { display: none; }

/* ---------- карточка автомобиля ---------- */
.car-top { display: grid; grid-template-columns: 270px repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.car-top .tiles { display: contents; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); color: var(--text); font-weight: 700; font-size: 17px; text-align: center; padding: 18px 12px; min-height: 150px; }
.tile .ico { width: 82px; height: 82px; stroke-width: 1.2; color: #1b1e23; }
.tile:hover { border-color: var(--blue); text-decoration: none; }
.tile.on { border-color: var(--blue); background: var(--blue-50); box-shadow: inset 0 0 0 1px var(--blue); }
.car-split { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.car-left { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }
.car-left .tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.car-left .tile { min-height: 0; padding: 10px 4px; font-size: 12px; gap: 6px; }
.car-left .tile .ico { width: 38px; height: 38px; stroke-width: 1.4; }
.info-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 20px; }
.fields.one { grid-template-columns: 1fr; }
.f { padding: 9px 0; border-bottom: 1px solid #eef1f4; min-width: 0; }
.f.wide { grid-column: 1 / -1; }
.f .k { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.f .v { font-weight: 600; overflow-wrap: anywhere; }
.phone-line { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.others { display: flex; flex-direction: column; gap: 6px; }
.others a { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.others .ico { color: var(--muted); }
details.inline { margin-top: 14px; }
details.inline > summary { cursor: pointer; color: var(--blue); font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.inline > summary::-webkit-details-marker { display: none; }
details.inline > summary .ico { width: 18px; height: 18px; }
.photo-big { width: 100%; max-height: 360px; object-fit: cover; border-radius: 12px; display: block; }
.photo-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px; background: var(--soft); border-radius: 12px; color: var(--muted); }
.photo-empty .carfront { width: 110px; height: 82px; color: #c3cad4; }

/* быстрое редактирование */
.ed { display: inline-block; min-width: 46px; padding: 2px 6px; margin: -2px -6px; border-radius: 7px; cursor: text; transition: background .15s; }
.ed:hover { background: #fff3c9; }
.ed.empty { color: var(--faint); font-weight: 400; }
.ed.block { display: block; white-space: pre-line; }
.ed.editing { display: block; background: none; padding: 0; margin: 0; cursor: default; }
.ed.saving { opacity: .5; }
.ed.ok { background: #d9f2e3; }
.ed-wrap { display: flex; gap: 6px; align-items: flex-start; }
.ed-input { min-height: 34px; padding: 5px 9px; font-weight: 500; }
textarea.ed-input { min-height: 80px; }
.ed-wrap .plus { min-height: 34px; width: 34px; font-size: 19px; }

/* набор ТО */
.kit { display: flex; flex-direction: column; gap: 10px; }
.kit-row { display: flex; gap: 14px; align-items: center; background: #e9ecf0; border-radius: 20px; padding: 10px 12px 10px 18px; }
.kit-cat { flex: 0 0 170px; font-weight: 700; min-width: 0; }
.kit-name { font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.kit-name .ed.empty { font-size: 12px; }
.kit-fields { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px 14px; }
.kit-f { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.kit-f .k { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 1px; white-space: nowrap; }
.kit-stock { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; justify-content: center; }
.kit-row .ed:hover { background: #fff; }

/* таблицы */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
.tbl th.right, .tbl td.right { text-align: right; }

/* настройки */
.set-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.logo-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.logo-prev { max-width: 240px; max-height: 130px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; object-fit: contain; }
.logo-prev.empty { width: 240px; height: 110px; display: flex; align-items: center; justify-content: center; color: var(--faint); background: var(--soft); border-style: dashed; }

/* ---------- статусы ---------- */
.badge.big { font-size: 13px; padding: 4px 12px; }
.st-open, .st-planned { background: var(--blue-50); color: var(--blue); }
.st-in_progress { background: #fff3d6; color: #8a5a00; }
.st-done { background: #e3f5ea; color: #17623c; }
.st-cancelled { background: #eef0f3; color: #7b8592; }
.st-no_show { background: #fdecec; color: #9b2323; }
.neg { color: var(--red); }
.pos { color: var(--green); }
.strong { font-weight: 700; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row form { margin: 0; }
.mb { margin: 0 0 14px; }
.pad { padding: 10px; }
.center { text-align: center; }
.page-head h1 .ico { width: 26px; height: 26px; margin-top: -3px; color: var(--muted); }

/* ---------- главная: блоки ---------- */
.dash-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.dline { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef1f4; color: var(--text); }
.dline:last-child { border-bottom: 0; }
.dline:hover { text-decoration: none; background: #fafbfc; }
.dline > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- каталог ---------- */
.finder { display: grid; grid-template-columns: 230px 250px minmax(0, 1fr); gap: 14px; align-items: start; }
.fcol { padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.fcol-head { display: flex; align-items: center; gap: 6px; }
.fcol-head h3 { margin: 0; flex: 1; min-width: 0; }
.fcol-head .plus { width: 32px; min-height: 32px; font-size: 19px; }
.ffilter { min-height: 34px; padding: 5px 10px; }
.flist { display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.flist a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; color: var(--text); font-weight: 500; }
.flist a span { flex: 1; min-width: 0; }
.flist a small { color: var(--faint); font-size: 12px; }
.flist a:hover { background: var(--soft); text-decoration: none; }
.flist a.on { background: var(--blue); color: #fff; }
.flist a.on small { color: rgba(255, 255, 255, .75); }

/* ---------- склад ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 9px 16px; border-radius: 11px; background: var(--panel); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.tabs a small { color: var(--faint); margin-left: 4px; }
.tabs a:hover { text-decoration: none; background: #f8fafc; }
.tabs a.on { background: var(--blue); color: #fff; }
.tabs a.on small { color: rgba(255, 255, 255, .75); }
.tabs a.warn { background: #fdecec; color: #9b2323; margin-left: auto; }
.stock-filters { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: center; }
.tbl-wrap { overflow-x: auto; }
.card.nopad { padding: 6px 10px; }
.stock-tbl td { vertical-align: top; }
.stock-tbl tr.low td { background: #fff8f8; }
.fits { max-width: 220px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; margin: 0 4px 4px 0; border-radius: 999px; background: var(--soft); font-size: 12.5px; font-weight: 600; }
.chip button { border: 0; background: none; color: var(--faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 50%; }
.chip button:hover { color: var(--red); }
.chip.add { padding: 2px 10px; border: 1px dashed var(--line-2); background: #fff; color: var(--blue); cursor: pointer; font-size: 14px; }
.qty-line { display: inline-flex; align-items: center; gap: 6px; }
.qbtn { width: 26px; height: 26px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--blue); font-size: 16px; line-height: 1; cursor: pointer; padding: 0; }
.qbtn:hover { background: var(--blue-50); }

/* ---------- запись ---------- */
.day-nav { display: flex; align-items: center; gap: 8px; }
.day-nav b { min-width: 230px; text-align: center; }
.sched { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.sched-left { display: flex; flex-direction: column; gap: 16px; }
.cal-sm .cal-year { font-size: 20px; }
.cal-sm .cal-month { margin-left: 40px; padding: 7px 12px; }
.cal-sm .cal-month b { font-size: 17px; }
.cal-sm .cal-day { height: 32px; font-size: 14px; border-radius: 8px; }
.cal-sm .cal-wd { font-size: 13px; }
.cal-sm .cal-dot { min-width: 14px; height: 14px; line-height: 14px; font-size: 9px; top: 1px; right: 1px; }
.cal-day.sel { background: var(--blue); color: #fff; }
.alist { padding: 8px 10px; margin: 0 -10px; border-radius: 10px; cursor: pointer; border-left: 4px solid transparent; }
.alist:hover { background: var(--soft); }
.alist.st-planned, .alist.st-in_progress, .alist.st-done, .alist.st-cancelled, .alist.st-no_show { background: none; color: inherit; }
.alist.st-planned { border-left-color: var(--blue); }
.alist.st-in_progress { border-left-color: #e3a008; }
.alist.st-done { border-left-color: var(--green); }
.alist.st-cancelled, .alist.st-no_show { border-left-color: #c3cad4; opacity: .7; }
.sched-card { padding: 12px; overflow-x: auto; }
.sgrid { display: flex; min-width: min-content; }
.stimes { flex: 0 0 56px; }
.scol { flex: 1 0 180px; border-left: 1px solid var(--line); }
.shead { height: 38px; display: flex; align-items: center; justify-content: center; font-weight: 700; border-bottom: 2px solid var(--line); }
.sbody { position: relative; }
.stime { height: var(--slot); font-size: 12px; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-8px); }
.stime:first-child { transform: none; }
.sslot { height: var(--slot); border-bottom: 1px dashed #eef1f4; }
.sslot.hour { border-top: 1px solid #e3e7ee; }
.scol .sbody { cursor: copy; }
.scol .sbody:hover .sslot { background: rgba(31, 116, 189, .02); }
.sapp { position: absolute; left: 4px; right: 4px; padding: 3px 8px; border-radius: 9px; overflow: hidden; cursor: pointer; border-left: 4px solid var(--blue); background: var(--blue-50); color: var(--text); font-size: 12.5px; line-height: 1.3; box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }
.sapp:hover { box-shadow: 0 3px 10px rgba(16, 24, 40, .18); z-index: 2; }
.sapp.st-in_progress { border-left-color: #e3a008; background: #fff6df; color: var(--text); }
.sapp.st-done { border-left-color: var(--green); background: #e8f6ee; color: var(--text); }
.sapp.st-cancelled, .sapp.st-no_show { border-left-color: #b5bdc8; background: #f1f3f6; color: var(--muted); text-decoration: line-through; }
.sapp-t { font-weight: 700; font-size: 11.5px; color: var(--muted); }
.sapp-c { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sapp-w { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- заказ-наряды ---------- */
.status-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; padding: 14px 18px; }
.status-bar form { margin: 0; }
.total-line { font-size: 18px; }
.order-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; align-items: start; }
.order-car { display: block; color: var(--text); line-height: 1.6; }
.order-car:hover { text-decoration: none; }
.otbl th.num, .otbl td.num { width: 34px; color: var(--muted); }
.otbl .sum-row td { border-bottom: 0; color: var(--muted); }
.otbl .sum-row b { color: var(--text); }
.oblock { display: block; border: 1.5px solid var(--line-2); border-radius: 18px; margin-bottom: 12px; overflow: hidden; color: var(--text); }
.oblock:hover { border-color: var(--blue); text-decoration: none; }
.oblock-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: #e9ecf0; }
.odate { font-weight: 800; letter-spacing: .5px; }
.oblock-body { padding: 8px 16px 12px; }
.oline { padding: 5px 0; border-bottom: 1px solid #e6e9ee; }
.oline:last-child { border-bottom: 0; }
.oline.sub { color: var(--muted); font-size: 13.5px; }
.date-sm { width: 150px; min-height: 34px; padding: 4px 8px; }
.kit-hint { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 14px 18px; background: var(--blue-50); box-shadow: none; border: 1px solid var(--blue-100); }
.kit-hint > .ico { width: 28px; height: 28px; color: var(--blue); }
.kit-hint > div { flex: 1; }

/* окно «Сохранить в набор» */
.modal:has(.ks) { width: min(900px, 100%); }
.ks-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ks-head label { width: 260px; }
.ks-mod { padding-bottom: 10px; }
.ks-rows { display: flex; flex-direction: column; gap: 8px; }
.ks-row { display: grid; grid-template-columns: minmax(0, 1fr) 210px 250px; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--soft); }
.ks-row.conflict { background: #fff6df; }
.ks-row select { min-height: 36px; padding: 5px 8px; }
.ks-state { color: var(--muted); margin-top: 2px; }
.ks-row.conflict .ks-state { color: #8a5a00; font-weight: 600; }

/* поле с поиском */
.lookup { position: relative; margin-top: 6px; }
.lookup input { margin: 0; }
.lookup-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 120; max-height: 260px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(16, 24, 40, .16); padding: 4px; }
.lookup-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text); font-weight: 500; }
.lookup-item:hover, .lookup-item.on { background: var(--blue-50); }
.lookup-empty { padding: 8px 10px; color: var(--muted); }
.modal-extra { display: flex; gap: 8px; flex-wrap: wrap; margin-right: auto; }
.mgrid .sel { margin-top: 6px; }

/* ---------- окна и уведомления ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(14, 24, 38, .4); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: min(580px, 100%); max-height: 92vh; overflow: auto; background: #fff; border-radius: 18px; padding: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.modal h3 { margin-bottom: 16px; font-size: 18px; }
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.mgrid .wide { grid-column: 1 / -1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 200; max-width: 420px; background: #17202c; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.bad { background: #a32626; }

/* ---------- вход ---------- */
body.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth { width: min(440px, 100%); background: #fff; border-radius: 20px; box-shadow: var(--shadow); padding: 30px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-logo { max-width: 180px; max-height: 110px; width: auto; height: 80px; }
.auth-head h1 { margin: 10px 0 6px; color: var(--blue-d); text-transform: uppercase; letter-spacing: .5px; }

/* ---------- адаптивность ---------- */
@media (max-width: 1000px) {
  .kit-row { flex-wrap: wrap; }
  .kit-cat { flex-basis: 100%; }
}
@media (max-width: 1100px) {
  .dash, .info-grid, .set-grid, .order-grid, .sched, .dash-cards { grid-template-columns: 1fr; }
  .finder { grid-template-columns: 1fr 1fr; }
  .finder .fwide { grid-column: 1 / -1; }
  .stock-filters { grid-template-columns: 1fr 1fr; }
  .car-top { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .car-top .mini { grid-column: 1 / -1; }
  .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; }
  .nav, .side-foot { flex-direction: row; flex-wrap: wrap; margin: 0; }
  .nav a, .side-foot > a { padding: 8px 10px; font-size: 12px; }
  .me { display: none; }
  .main { padding: 16px; }
  .grid3, .grid2, .filters, .newcar-head, .car-split, .mgrid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .car-left { position: static; }
  .carrow { grid-template-columns: 80px minmax(0, 1fr) auto; gap: 10px; }
  .carrow-img .carfront { width: 70px; height: 52px; }
}
