/* OrdersPortal — стили главной страницы (светлая, деловая) */
:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #d9e0e8;
  --text: #1c2733;
  --muted: #6b7a8c;
  --accent: #1f6feb;
  --ok: #1a7f37;
  --warn: #b54708;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
.top {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 22px; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; }
.nav { display: flex; gap: 16px; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--accent); }
.who { margin-left: auto; color: var(--muted); font-size: 13px; }
/* кто вошёл в кабинет Orders2: имя и телефон — как в шапке кабинета */
.who.client { margin-left: auto; text-align: right; line-height: 1.25; }
.who-name { font-weight: 700; font-size: 14px; color: var(--text); }
.who-phone { font-size: 11px; color: var(--muted); }
/* ссылка входа в кабинет Orders2 (у портала своей формы входа нет) */
.who-login { color: var(--accent); font-size: 13px; text-decoration: none; }
.who-login:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 26px auto; padding: 0 18px; }
h1 { font-size: 22px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.searchbar {
  display: flex; gap: 10px; margin: 18px 0 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px;
}
.searchbar input[type=text] {
  flex: 1 1 auto; min-width: 180px;
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 15px;
}
.searchbar select {
  min-width: 220px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.searchbar button {
  padding: 10px 22px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 15px; cursor: pointer;
}
.searchbar button:hover { filter: brightness(1.06); }
.searchbar button:disabled { opacity: .6; cursor: default; }

/* дубль окна поиска на внутренних страницах: липнет к верху, чтобы можно было
   пробить другой артикул, не возвращаясь назад по страницам */
.searchbar.compact {
  margin: 0 0 14px; padding: 8px 10px;
  position: sticky; top: 0; z-index: 40;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}
.searchbar.compact input[type=text] { padding: 7px 10px; font-size: 14px; }
.searchbar.compact button { padding: 7px 16px; font-size: 14px; }

.status { min-height: 22px; color: var(--muted); margin: 6px 2px; }
.status.err { color: var(--warn); }
.status.ok { color: var(--ok); }

.result { margin-top: 8px; }

/* --- баннер на главной: картинка или видео из app/static/banner.* (см. app/web.py) --- */
/* отступ сверху побольше: строка поиска должна «дышать» (8px снизу у формы + 34px) */
.banner { margin: 34px 0 6px; }
.banner img, .banner video {
  display: block; width: 100%; height: auto; border-radius: 10px;
}
/* видео-баннер: во всю ширину, но не выше 470 px — кадр 16:9 обрезается по краям
   (object-fit: cover), поэтому полоса остаётся баннерной, а не на весь экран.
   Курсор-«рука»: щелчок по ролику ставит его на паузу (portal-banner.js). */
.banner video {
  object-fit: cover; object-position: center; max-height: 470px; cursor: pointer;
}
/* обычная картинка (без эффектов): тоже баннерная полоса, а не на весь экран;
   кадр при этом не растягивается — лишняя высота аккуратно обрезается по центру */
.banner img:not(.banner__still) {
  object-fit: cover; object-position: center; max-height: 470px;
}

/* --- «живой» баннер: картинка + эффекты (файл banner-live.jpg, см. app/web.py) ---
   Всё на CSS — ни видео, ни лишних файлов. Сейчас стоит чёрно-белое фото GT-R
   сзади: кадр чуть «дышит», по небу плывёт тень облака и дымка, задние фонари
   светятся красным и мягко «дышат» (как стоп-сигналы).
   Координаты фонарей заданы в процентах от картинки: под другую картинку
   достаточно поправить шесть переменных ниже. */
.banner--live {
  --lamp-l-x: 67.4%; --lamp-l-y: 46.8%;   /* центр левой пары фонарей */
  --lamp-r-x: 82.7%; --lamp-r-y: 46.8%;   /* центр правой пары фонарей */
  --lamp-half-w: 5.5%; --lamp-half-h: 9.5%; /* половина размера свечения */
  position: relative; overflow: hidden; border-radius: 10px; line-height: 0;
}
/* Координаты фонарей для каждого варианта картинки. Вариант выбирает владелец
   в админке портала («Картинка на главной»), файлы — banner-1..3.* в app/static.
   Значения ниже — центр пары фонарей в процентах от картинки. */
.banner--live.banner--v1 {
  --lamp-l-x: 67.4%; --lamp-l-y: 46.8%; --lamp-r-x: 82.7%; --lamp-r-y: 46.8%;
}
/* Варианты 2 и 3 пока не замерены: пока стоят координаты первого. Когда файл
   появится — померить и подставить сюда (иначе свечение будет не на фонарях). */
.banner--live.banner--v2 {
  --lamp-l-x: 67.4%; --lamp-l-y: 46.8%; --lamp-r-x: 82.7%; --lamp-r-y: 46.8%;
}
.banner--live.banner--v3 {
  --lamp-l-x: 67.4%; --lamp-l-y: 46.8%; --lamp-r-x: 82.7%; --lamp-r-y: 46.8%;
}
.banner--live .banner__still {
  display: block; width: 100%; height: auto;
  animation: banner-breathe 16s ease-in-out infinite alternate;
  transform-origin: 50% 50%;
}
.banner--live span { position: absolute; pointer-events: none; }

/* облака: по небу медленно плывёт тень облака (затемняет) и лёгкая дымка */
.banner__smoke { border-radius: 50%; filter: blur(30px); }
.banner__smoke--a {
  left: -10%; top: -18%; width: 44%; height: 46%; opacity: .5;
  mix-blend-mode: multiply;
  background: radial-gradient(closest-side, rgba(100,100,105,.5), rgba(140,140,145,0) 72%);
  animation: banner-smoke-a 26s ease-in-out infinite alternate;
}
.banner__smoke--b {
  right: -14%; top: -24%; width: 52%; height: 52%; opacity: .35;
  mix-blend-mode: screen;
  background: radial-gradient(closest-side, rgba(255,255,255,.55), rgba(255,255,255,0) 72%);
  animation: banner-smoke-b 30s ease-in-out infinite alternate;
}

/* задние фонари: светятся красным и мягко «дышат» */
.banner__glow {
  width: calc(var(--lamp-half-w) * 2); height: calc(var(--lamp-half-h) * 2);
  border-radius: 50%; opacity: .5;
  filter: blur(12px); mix-blend-mode: screen;
  background: radial-gradient(closest-side, rgba(255,45,35,.95), rgba(255,0,0,0) 72%);
}
.banner__glow--l {
  left: calc(var(--lamp-l-x) - var(--lamp-half-w));
  top: calc(var(--lamp-l-y) - var(--lamp-half-h));
  animation: banner-lamp-l 11s ease-in-out infinite;
}
.banner__glow--r {
  left: calc(var(--lamp-r-x) - var(--lamp-half-w));
  top: calc(var(--lamp-r-y) - var(--lamp-half-h));
  animation: banner-lamp-r 13s ease-in-out infinite;
}

@keyframes banner-breathe {
  from { transform: scale(1); }
  to   { transform: scale(1.04); }
}
@keyframes banner-smoke-a {
  from { transform: translate3d(-6%, 2%, 0) scale(1); }
  to   { transform: translate3d(14%, -3%, 0) scale(1.18); }
}
@keyframes banner-smoke-b {
  from { transform: translate3d(8%, 3%, 0) scale(1.12); }
  to   { transform: translate3d(-12%, -2%, 0) scale(1); }
}
/* фонари «дышат»: то ярче, то спокойнее; левая и правая — вразнобой */
@keyframes banner-lamp-l {
  0%   { opacity: .5; }
  30%  { opacity: .9; }
  50%  { opacity: .55; }
  68%  { opacity: 1; }
  84%  { opacity: .6; }
  100% { opacity: .5; }
}
@keyframes banner-lamp-r {
  0%   { opacity: .6; }
  26%  { opacity: 1; }
  48%  { opacity: .55; }
  70%  { opacity: .85; }
  88%  { opacity: .5; }
  100% { opacity: .6; }
}
/* кому анимация мешает (или экономит батарею) — показываем просто картинку */
@media (prefers-reduced-motion: reduce) {
  .banner--live .banner__still,
  .banner__smoke--a, .banner__smoke--b,
  .banner__glow--l, .banner__glow--r { animation: none; }
  .banner__smoke--a { opacity: .2; }
  .banner__smoke--b { opacity: .15; }
  .banner__glow--l, .banner__glow--r { opacity: .55; }
}
table.offers {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px;
}
/* углы скруглены вручную: overflow:hidden тут нельзя — он обрезал бы всплывающее описание */
table.offers th:first-child { border-top-left-radius: 9px; }
table.offers th:last-child { border-top-right-radius: 9px; }
table.offers tr:last-child td:first-child { border-bottom-left-radius: 9px; }
table.offers tr:last-child td:last-child { border-bottom-right-radius: 9px; }
table.offers th, table.offers td {
  padding: 9px 11px; border-bottom: 1px solid var(--line);
  text-align: left; font-size: 14px;
}
table.offers th { background: #eef2f7; color: #33475b; font-weight: 600; }
table.offers tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
td.stock { color: var(--ok); font-weight: 600; }
td.nostock { color: var(--muted); }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  background: #eef2f7; color: #33475b; font-size: 12px;
}
.badge-ok { background: #e7f5ea; color: var(--ok); }
.badge-warn { background: #fdeee7; color: var(--warn); }
/* страница статуса: пояснения к состоянию сервиса */
.notes { margin: 8px 0 14px; padding-left: 20px; color: var(--muted); font-size: 13px; }
.notes li { margin: 2px 0; }
.foot { padding: 18px 22px 30px; text-align: center; }

/* колонка возврата: зелёный домик — возврат возможен, домик с красным крестиком — нет */
td.c, th.c { text-align: center; }
.ret-yes { color: #1a7f37; }
.ret-no { color: #d1242f; }
th.sortable a { color: inherit; text-decoration: none; }
th.sortable a:hover { text-decoration: underline; }

/* наименование: как у Автоспутника — короткая строка с «…» и значок «i» с полным описанием */
td .namecell { display: flex; align-items: center; gap: 6px; }
td .name {
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
td .info {
  position: relative;
  flex: 0 0 auto;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #1c2733; color: #fff;
  font: italic 700 11px/16px Georgia, "Times New Roman", serif;
  text-align: center;
  cursor: help;
  user-select: none;
}
td .info:hover, td .info:focus { z-index: 30; outline: none; }
td .info .popup {
  display: none;
  position: absolute; left: -6px; top: 22px; z-index: 30;
  width: 330px; padding: 9px 11px;
  background: #1c2733; color: #fff;
  border-radius: 8px; box-shadow: 0 8px 22px rgba(0, 0, 0, .22);
  font: 400 12px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-style: normal;
  text-align: left; white-space: normal;
}
td .info:hover .popup, td .info:focus .popup { display: block; }
td .info .popup .pop-title { display: block; margin-bottom: 6px; font-weight: 600; }
td .info .popup .pop-row { display: block; }
td .info .popup .pop-row b { color: #a8c0dd; font-weight: 600; }
td .info .popup .muted { color: #9fb3c8; }

/* стрелки прокрутки как у Автоспутника: «вниз» — справа сверху, «вверх» — справа снизу */
.scrollbtn {
  position: fixed; right: 0; z-index: 50;
  width: 46px; height: 46px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px 0 0 8px;
  background: #e60012; color: #fff;
  cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}
.scrollbtn:hover { background: #c4000f; }
.scrollbtn:active { transform: translateY(1px); }
.scrollbtn[hidden] { display: none; }
#scrollDown { top: 62px; }
#scrollUp { bottom: 14px; }

/* ---------- кнопки кабинета: как на странице «Подбор запчастей по VIN» ----------
   Формат и цвет скопированы из кабинета Orders2 (.cp-garage-btn), но здесь это
   ссылки в кабинет, поэтому добавлен text-decoration: none. */
.cp-wrap { position: relative; }
.cp-side {
  position: absolute; left: -208px; top: 0; width: 196px;
  display: flex; flex-direction: column; gap: 8px;
}
.cp-garage-btn {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 11px 13px; border-radius: 12px;
  border: 1px solid #c7dbff; background: linear-gradient(180deg, #f7faff, #e9f1ff); color: #1d3f8f;
  font: 700 13px/18px "Segoe UI", Tahoma, sans-serif; cursor: pointer; text-align: left;
  box-shadow: 0 2px 6px rgba(29, 78, 216, .10); text-decoration: none;
}
.cp-garage-btn:hover {
  background: linear-gradient(180deg, #eef5ff, #dbe9ff); border-color: #93b8ff;
  box-shadow: 0 3px 10px rgba(29, 78, 216, .16);
}
.cp-garage-ic { font-size: 16px; line-height: 1; }
.cp-garage-txt { flex: 1 1 auto; }
/* порог выше, чем в кабинете (там 1320 px): контент портала шире, и левая колонка
   должна целиком помещаться в окне, иначе появится горизонтальная прокрутка */
@media (max-width: 1500px) {
  .cp-side {
    position: static; width: auto; margin-bottom: 12px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  }
}
@media (max-width: 560px) {
  .cp-side { grid-template-columns: 1fr; }
}

/* ==================== КОРЗИНА (в стиле Автоспутника) ==================== */
/* кнопка-корзина в строке предложения */
td.cartcell { white-space: nowrap; text-align: center; }
.ico-cart {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 26px; padding: 0; border: 1px solid #f4c9ce; border-radius: 6px;
  background: #fff; color: #e60012; cursor: pointer;
}
.ico-cart:hover { background: #fdecee; border-color: #e60012; }
.ico-cart svg { display: block; }
/* корзина в шапке портала: счётчик и сумма */
.top-cart {
  display: inline-flex; align-items: center; gap: 8px; margin-left: 12px;
  padding: 6px 12px; border-radius: 8px; background: #e60012; color: #fff;
  text-decoration: none; font-size: 13px; font-weight: 700;
}
.top-cart:hover { background: #c4000f; }
.top-cart svg { display: block; }
.top-cart .cnt { padding: 0 7px; border-radius: 999px; background: #fff; color: #e60012; font-size: 12px; }
.top-cart .sum { font-weight: 700; }
.hidden { display: none !important; }

/* модальное окно «Товар добавлен в корзину» */
.cart-modal {
  position: fixed; inset: 0; z-index: 2000; padding: 40px 16px;
  display: flex; align-items: flex-start; justify-content: center;
  background: rgba(15, 23, 42, .45); overflow: auto;
}
.cart-modal.hidden { display: none !important; }
.cart-card {
  width: 470px; max-width: 100%; padding: 14px 18px 18px;
  background: #fff; border-radius: 6px; box-shadow: 0 24px 60px rgba(2, 6, 23, .35);
}
.cart-head { display: flex; align-items: center; gap: 8px; padding-bottom: 10px;
  border-bottom: 1px solid #e6ebf2; }
.cart-head .ok { color: #16a34a; font-size: 15px; }
.cart-head .ttl { flex: 1 1 auto; font-weight: 700; font-size: 14px; color: #0f172a; }
.cart-x { border: 0; background: transparent; color: #94a3b8; font-size: 18px;
  line-height: 1; cursor: pointer; }
.cart-x:hover { color: #334155; }
.cart-body { display: flex; gap: 14px; padding: 12px 0 4px; }
.cart-img { flex: 0 0 140px; height: 100px; display: flex; align-items: center;
  justify-content: center; border: 1px solid #e6ebf2; border-radius: 4px;
  background: #f8fafc; color: #cbd5e1; }
.cart-info { flex: 1 1 auto; min-width: 0; font-size: 13px; color: #334155; }
.cart-info .nm { margin-bottom: 6px; font-weight: 700; color: #0f172a; }
.cart-info .ln { margin: 3px 0; }
.cart-info .ln b { font-weight: 700; color: #0f172a; }
.cart-info .fld { margin-top: 6px; }
.qty { display: inline-flex; align-items: center; }
.qty-b { width: 26px; height: 24px; border: 1px solid #cfd8e3; background: #fff;
  color: #334155; cursor: pointer; font-size: 14px; line-height: 1; }
.qty-b:hover { background: #f1f5f9; }
.qty-i { width: 54px; height: 24px; border: 1px solid #cfd8e3; border-left: 0;
  border-right: 0; text-align: center; font: 13px/22px "Segoe UI", Tahoma, sans-serif; }
.cart-comment { width: 100%; height: 26px; padding: 0 8px; border: 1px solid #cfd8e3;
  border-radius: 4px; font-size: 13px; }
.cart-actions { display: flex; gap: 10px; margin-top: 14px; }
.cart-go, .cart-more { height: 34px; padding: 0 16px; border-radius: 4px; cursor: pointer;
  font: 700 13px/32px "Segoe UI", Tahoma, sans-serif; text-align: center; text-decoration: none; }
.cart-go { flex: 0 0 auto; border: 1px solid #e60012; background: #e60012; color: #fff; }
.cart-go:hover { background: #c4000f; border-color: #c4000f; }
.cart-more { flex: 1 1 auto; border: 1px solid #cfd8e3; background: #fff; color: #334155; }
.cart-more:hover { background: #f8fafc; }
body.cart-open { overflow: hidden; }

/* страница /cart */
.cart-del { border: 0; background: transparent; color: #94a3b8; cursor: pointer; font-size: 14px; }
.cart-del:hover { color: #d1242f; }
.cart-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 14px; }
.cart-total-lbl { font-size: 14px; color: #334155; }
.cart-total { font-size: 18px; font-weight: 700; color: #0f172a; }
.cart-note { margin-top: 12px; }

/* корзина кабинета на странице /cart (общая с подбором по VIN) */
.cart-cab-head {
  margin-bottom: 10px; padding: 8px 10px; font-size: 13px; color: #1d3f8f;
  background: #f7faff; border: 1px solid #c7dbff; border-radius: 8px;
}
.cart-foot .cart-go { display: inline-block; line-height: 34px; margin-right: 10px; }

/* форма отправки заявки и подтверждение (страница /cart) */
.cart-checkout {
  margin-top: 16px; padding: 12px 14px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.cc-title { margin-bottom: 10px; font-weight: 700; font-size: 15px; color: #0f172a; }
.cc-row { display: flex; flex-wrap: wrap; gap: 14px; }
.cc-fld {
  display: flex; flex-direction: column; gap: 4px;
  margin: 0 0 10px; font-size: 12px; color: var(--muted); min-width: 220px; flex: 1 1 220px;
}
.cc-fld input {
  height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; color: var(--text);
}
.cc-req { color: #e60012; }
.cc-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cc-msg { font-size: 13px; color: var(--muted); }
.cc-msg.err { color: #d1242f; }
.cc-hint { margin-top: 8px; }
.cart-done {
  margin-top: 16px; padding: 14px 16px;
  background: #e7f5ea; border: 1px solid #bfe3c8; border-radius: 10px;
}
.cd-title { font-weight: 700; font-size: 15px; color: var(--ok); }
.cd-text { margin: 6px 0 10px; font-size: 14px; color: var(--text); }
.cart-done .cart-more { display: inline-block; flex: 0 0 auto; }

/* --- поставщики: метка источника в таблицах (см. app/suppliers/) --- */
.src {
  display: inline-block; font-size: 11px; line-height: 1.5;
  color: #37474f; background: #eceff1; border-radius: 10px;
  padding: 1px 7px; white-space: nowrap;
}
.ret-q { color: #b26a00; font-weight: 700; }
.status.warn { color: #8a5300; background: #fff8e1; border-color: #ffe0a3; }

