/* AG Auto — рабочий кабинет. Тёмно-синий и золото, как в буклетах. */
:root {
  --bg: #eef1f6; --panel: #fff; --ink: #14203a; --mute: #5b6782; --line: #dbe1ec; --field: #f8f9fc;
  --navy: #0b2552; --navy2: #12346f; --gold: #b8902f; --gold2: #d9b45a; --gold-soft: #f6efdc;
  --ok: #1d7a46; --ok-bg: #e5f4ea; --warn: #a3401c; --warn-bg: #fbece4;
  --font: "Segoe UI", "Golos Text", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
a { color: var(--navy2); }
h1 { font-size: 26px; margin: 0 0 4px; color: var(--navy); }
h2 { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); margin: 0 0 12px; font-weight: 800; }
h3 { margin: 0; font-size: 18px; color: var(--navy); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 22px 16px 60px; }
.sub { color: var(--mute); margin: 0 0 18px; }

/* шапка */
.top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 5; border-bottom: 3px solid var(--gold2); }
.top-in { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; }
.brand img { width: 38px; height: 38px; border-radius: 50%; background: #fff; object-fit: cover; object-view-box: inset(23.5% 35.8% 23.8% 12.7%); }
nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav a { color: #c9d4e8; text-decoration: none; padding: 7px 12px; border-radius: 8px; font-weight: 600; }
nav a.on, nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
nav b { background: var(--gold2); color: var(--navy); border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 4px; }
.who { display: flex; gap: 10px; align-items: center; color: #c9d4e8; font-size: 14px; }

/* элементы */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.grid2 > *, .stack > * { min-width: 0; }
.stack { display: grid; gap: 14px; }
@media (max-width: 880px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.fields .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .fields { grid-template-columns: minmax(0, 1fr); } }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--mute); min-width: 0; }
label small { font-weight: 400; }
input, select, textarea { width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; }
textarea { min-height: 90px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--gold2); outline-offset: 1px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--ink); }
.check input { width: auto; }
button, .btn { font: inherit; font-weight: 700; font-size: 14px; border-radius: 9px; padding: 9px 16px; cursor: pointer; border: 1px solid var(--navy); background: var(--navy); color: #fff; text-decoration: none; display: inline-block; }
button.ghost, .btn.ghost { background: transparent; color: var(--navy); }
button.gold { background: var(--gold2); border-color: var(--gold2); color: var(--navy); }
button.ok { background: var(--ok); border-color: var(--ok); }
button.bad { background: transparent; border-color: var(--warn); color: var(--warn); }
button.link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 20px; padding: 2px 9px; background: var(--gold-soft); color: var(--gold); }
.pill.wait { background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.warn { background: var(--warn-bg); color: var(--warn); border-radius: 9px; padding: 10px 12px; font-size: 14px; font-weight: 600; margin-top: 10px; }
.muted { color: var(--mute); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* смета */
.total { margin-top: 12px; background: var(--navy); color: #fff; border-radius: 12px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.total span { font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 700; color: #c9d4e8; }
.total b { font-size: 30px; font-variant-numeric: tabular-nums; color: var(--gold2); }
.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--mute); padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: right; }
td small { display: block; color: var(--mute); font-size: 12px; }
.duty { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.duty div { background: var(--gold-soft); border-radius: 10px; padding: 8px 11px; }
.duty span { display: block; font-size: 12px; color: var(--mute); }

/* машины */
.cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.car { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.car img { width: 100%; height: 160px; object-fit: cover; display: block; background: var(--field); }
.car .b { padding: 12px 14px; display: grid; gap: 4px; }
.car .price { font-weight: 800; color: var(--navy); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ph { position: relative; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: var(--field); }
.ph img { display: block; width: 100%; height: 110px; object-fit: cover; }
.ph .pill { position: absolute; left: 6px; top: 6px; }
.ph.pick { cursor: pointer; }
.ph.sel { border-color: var(--gold2); }
.ph.sel::after { content: attr(data-n); position: absolute; right: 6px; top: 4px; background: var(--gold2); color: var(--navy); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; font-weight: 800; }
.trims { display: grid; gap: 8px; }
.trim { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.trim .t { font-size: 11.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.trim .n { font-weight: 700; color: var(--navy); }

/* вход */
.auth { max-width: 420px; margin: 7vh auto 0; }
.auth .logo { width: 84px; height: 84px; border-radius: 50%; background: #fff; display: block; margin: 0 auto 12px; object-fit: cover; object-view-box: inset(23.5% 35.8% 23.8% 12.7%); border: 1px solid var(--line); }
.auth h1 { text-align: center; }
.auth .sub { text-align: center; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button { flex: 1; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 600; z-index: 20; max-width: calc(100% - 32px); }
#toast.err { background: var(--warn); }
dialog { border: 0; border-radius: 14px; padding: 20px; max-width: 560px; width: calc(100% - 32px); }
/* Прайс «Из Китая» / «Из Бишкека»: карточка машины с ценами под ключ по комплектациям */
.pls { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 16px; align-items: start; }
.pl { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.pl-head { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; padding: 12px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.pl-head img { width: 150px; height: 100px; object-fit: cover; border-radius: 10px; background: var(--field); }
.pl-head > div { display: grid; gap: 3px; align-content: start; min-width: 0; }
.pl-head .price { font-weight: 800; color: var(--navy); font-size: 17px; }
.pl table { font-size: 13.5px; }
.pl th { padding: 7px 12px; }
.pl td { padding: 7px 12px; }
.pl td small { display: block; }
.pl-foot { padding: 10px 12px; justify-content: flex-end; }
@media (max-width: 520px) { .pl-head { grid-template-columns: 1fr; } .pl-head img { width: 100%; height: 160px; } }
/* Переключатель «Страна ввоза» */
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--field); }
.seg label { flex: 1; display: block; cursor: pointer; margin: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: block; text-align: center; padding: 10px 8px; font-size: 14px; font-weight: 700; color: var(--mute); }
.seg input:checked + span { background: var(--navy); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--gold2); outline-offset: -2px; }
/* 30-минутная мощность гибрида — всегда подсвечена для перепроверки */
.check-power input, input.check-power { background: #fff6d6; border-color: #e0b84a; }
.pill.power { background: #fff6d6; color: #8a5a00; }
/* Нет льготного утильсбора (мощнее 160 л.с.) */
.warn.util { background: #fdeceb; color: #a8322b; border-left: 4px solid #d9483f; }
.pill.util { background: #fdeceb; color: #a8322b; margin-top: 6px; }
dialog.wide { max-width: 980px; max-height: 90vh; }
dialog::backdrop { background: rgba(8, 20, 45, .5); }
/* Отчёт об осмотре Guazi */
.bad-n { color: #a8322b; }
details.report summary { cursor: pointer; font-weight: 700; margin: 10px 0 6px; }
.report-text { white-space: pre-wrap; max-height: 420px; overflow: auto; font-size: 13px; line-height: 1.45; background: var(--field); border-radius: 9px; padding: 10px 12px; margin-bottom: 10px; }
/* КП: выбор титульного фото */
.ph-title { position: absolute; left: 6px; bottom: 6px; padding: 3px 8px; font-size: 12px; background: rgba(255,255,255,.92); color: var(--navy); border: 0; border-radius: 6px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.ph.pick:hover .ph-title, .ph.pick:focus-within .ph-title { opacity: 1; }
.ph.title { border-color: var(--navy); box-shadow: 0 0 0 2px var(--gold2); }
.ph.title::after { width: auto; padding: 0 8px; border-radius: 11px; }
.ph.title .ph-title { display: none; }
ul.issues { margin: 6px 0 10px; padding-left: 20px; color: #a8322b; font-size: 14px; } ul.issues li { margin: 3px 0; }
figure.rep-ph { margin: 0; } figure.rep-ph figcaption { font-size: 12px; color: var(--mute, #667); margin-top: 4px; line-height: 1.3; }
/* Ролик-подсказка «перетащите → AG Auto на панель закладок» (вкладка Guazi). Окно 320×200, цикл 5 с */
.bm-howto { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.bm-howto > p { margin: 0; }
.bm-demo { margin: 0; width: 320px; max-width: 100%; }
.bm-demo figcaption { font-size: 13px; color: var(--mute); margin-top: 6px; text-align: center; }
.bm-win { position: relative; width: 320px; height: 200px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); box-shadow: 0 4px 14px rgba(11, 37, 82, .1); font: 600 11px/1 system-ui, sans-serif; }
.bm-top { height: 30px; background: #e4e8f1; display: flex; align-items: center; gap: 5px; padding: 0 8px; }
.bm-top i { width: 8px; height: 8px; border-radius: 50%; background: #c3cad8; }
.bm-addr { margin-left: 6px; flex: 1; background: #fff; border-radius: 10px; padding: 4px 8px; color: #5b6782; font-weight: 500; }
.bm-bar { position: relative; height: 22px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.bm-old { background: var(--gold-soft); color: #8a6a1e; border-radius: 6px; padding: 3px 6px; }
.bm-slot { position: absolute; left: 70px; top: 3px; width: 68px; height: 16px; border: 2px dashed var(--gold2); border-radius: 6px; opacity: 0; animation: bm-slot 5s infinite; }
.bm-new { position: absolute; left: 72px; top: 4px; color: var(--ink); padding: 2px 4px; border-radius: 5px; opacity: 0; animation: bm-new 5s infinite; }
.bm-bar-hint { position: absolute; right: 8px; color: #9aa3b5; font-weight: 500; font-size: 10px; }
.bm-page { position: relative; height: 147px; padding: 14px 16px; }
.bm-line { display: block; height: 9px; width: 70%; background: #d5dbe7; border-radius: 4px; margin-bottom: 8px; }
.bm-line.s { width: 45%; }
.bm-btn, .bm-ghost { position: absolute; width: 96px; height: 28px; border-radius: 7px; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 12px; }
.bm-btn { left: 40px; top: 68px; animation: bm-btn 5s infinite; }
.bm-ghost { left: 0; top: 0; transform-origin: center; opacity: 0; pointer-events: none; animation: bm-ghost 5s infinite; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.bm-cur { position: absolute; left: 0; top: 0; animation: bm-cur 5s infinite; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .3)); }
.bm-done { position: absolute; left: 76px; top: 62px; background: #1f7a3d; color: #fff; border-radius: 6px; padding: 5px 9px; opacity: 0; animation: bm-done 5s infinite; }
/* Курсор: к кнопке → зажал → несёт на панель закладок → отпустил */
@keyframes bm-cur {
  0% { transform: translate(250px, 175px); opacity: 1; }
  16%, 20% { transform: translate(88px, 134px); }
  22% { transform: translate(88px, 134px) scale(.85); }
  55% { transform: translate(104px, 40px) scale(.85); }
  60%, 82% { transform: translate(104px, 40px); opacity: 1; }
  92%, 100% { transform: translate(104px, 40px); opacity: 0; }
}
@keyframes bm-ghost {
  0%, 21% { transform: translate(40px, 120px); opacity: 0; }
  22% { transform: translate(40px, 120px); opacity: .9; }
  55% { transform: translate(56px, 26px) scale(.7); opacity: .9; }
  59%, 100% { transform: translate(56px, 26px) scale(.7); opacity: 0; }
}
@keyframes bm-btn { 0%, 19% { box-shadow: none; } 22%, 55% { box-shadow: 0 0 0 3px var(--gold2); opacity: .55; } 60%, 100% { box-shadow: none; opacity: 1; } }
@keyframes bm-slot { 0%, 26% { opacity: 0; } 32%, 56% { opacity: 1; } 60%, 100% { opacity: 0; } }
@keyframes bm-new { 0%, 57% { opacity: 0; background: transparent; } 60% { opacity: 1; background: var(--gold-soft); } 75%, 92% { opacity: 1; background: transparent; } 100% { opacity: 0; } }
@keyframes bm-done { 0%, 61% { opacity: 0; transform: translateY(4px); } 66%, 90% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; } }
/* Без анимации (настройка «уменьшить движение»): показываем итог */
@media (prefers-reduced-motion: reduce) {
  .bm-win * { animation: none !important; }
  .bm-new, .bm-done { opacity: 1; }
  .bm-cur { transform: translate(104px, 40px); }
}
/* Статистика руководителя */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 3px; }
.stat b { font-size: 26px; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--ink); font-weight: 600; }
.stat small { font-size: 12px; color: var(--mute); }
.st-table th { white-space: nowrap; }
.st-table .st-sum td { font-weight: 800; border-top: 2px solid var(--line); }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 110px; border-bottom: 1px solid var(--line); }
.bars .bar { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.bars .bar i { display: block; width: 100%; background: var(--navy); border-radius: 4px 4px 0 0; }
.bars .bar:hover i { background: var(--gold); }
.bars-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--mute); margin-top: 4px; }
/* Пост-подборка: отметка на карточке и панель снизу */
.pl-pick { font-size: 13px; margin-right: auto; }
.pick-bar { position: sticky; bottom: 12px; z-index: 5; margin-top: 14px; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; background: var(--navy); color: #fff; border-radius: 12px; padding: 10px 14px; box-shadow: 0 6px 18px rgba(11, 37, 82, .3); }
.pick-bar .ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
#pd-text { min-height: 300px; }
/* Мой профиль: ссылка на имя в шапке и предпросмотр подписи */
a#who { color: inherit; text-decoration: none; border-bottom: 1px dashed rgba(255,255,255,.5); }
a#who:hover { border-bottom-style: solid; }
.sig-preview { white-space: pre-wrap; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.5; min-height: 60px; }

/* Загрузка списком с Guazi */
table.ub td { vertical-align: middle; }
table.ub input.num { width: 84px; text-align: right; }
.ub-car { display: flex; gap: 10px; align-items: center; min-width: 260px; }
.ub-car img { width: 84px; height: 58px; object-fit: cover; border-radius: 6px; flex: none; background: #eee; }
.ub-note { margin-top: 4px; }
/* Смета комплектации: расшифровка и правки по согласованию */
dialog.est-dlg { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; }
dialog.est-dlg tr.adj td { background: #fff8e6; }
dialog.est-dlg tr.sum td { border-top: 2px solid currentColor; }
.note-adj { background: #fff8e6; border: 1px solid #f0d79a; border-radius: 10px; padding: 10px 12px; }
.note-adj.pend { background: #eef4ff; border-color: #b9cdf0; }
ul.est-how { margin: 8px 0 0; padding-left: 20px; line-height: 1.6; }
.es-line input:first-child { flex: 1; min-width: 180px; }