/* ==========================================================================
   STALZONE ECHO — единый стиль сайта (STALKER: Зона, радиация, янтарь)
   Тёмная постапокалиптичная тема: зерно плёнки, виньетка, свечение аномалий.
   ========================================================================== */

:root {
  --bg: #0a0d0a;                  /* гнилая хвоя ночью */
  --bg-soft: #10130e;
  --card: rgba(255, 255, 255, 0.028);
  --card-hover: rgba(255, 255, 255, 0.05);
  --card-solid: #12150f;
  --border: rgba(170, 160, 116, 0.14);
  --border-strong: rgba(170, 160, 116, 0.3);
  --accent: #d5953f;                 /* янтарь фонарей Зоны */
  --accent-rgb: 213, 149, 63;
  --accent-soft: rgba(213, 149, 63, 0.12);
  --toxic: #aab94e;                  /* радиоактивная зелень аномалий */
  --toxic-rgb: 170, 185, 78;
  --warning: #cd7135;
  --warning-rgb: 205, 113, 53;
  --text: #dcd6c4;
  --muted: #8f8a76;
  --danger: #cf5242;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  --glow: 0 0 18px rgba(var(--accent-rgb), 0.45);
  --chart-bg: #0a0e0b;
  --grid: #141a14;
  --axis: #7c8478;
  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Светлая тема убрана: сайт всегда тёмный.
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }

html {
  min-height: 100%;
  background:
    /* Тёмная база под фото (страховка, если фото не загрузится) */
    linear-gradient(180deg, #0b0e09, #060806 60%, #040504 100%);
  background-color: #0a0d0a;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background: transparent;
}

/* --------------------------------------------------------------------------
   Живой фон Зоны: фото Припяти, дрейф тумана, пульс зарева выброса,
   вспышки молний. Один прозрачный слой под контентом, поверх тёмной базы.
   Фото смещено к правому краю — центр экрана остаётся спокойным под панели,
   а детали Зоны (колесо, ЛЭП) уходят к краям.
   -------------------------------------------------------------------------- */
.stalker-fx {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  /* Живой фон Зоны. Сам SVG-тарник (небо, облака, молнии, ЛЭП, колесо,
     аномалии, птицы) инлайнится в DOM из /bg/zone.svg — все анимации в нём
     работают как обычные CSS. Здесь — только контейнер и слои эффектов. */
}
.stalker-fx svg {
  display: block;
  width: 100%;
  height: 100%;
}
/* Дрейфующий туман: крупные пятна медленно плывут вбок (север Зоны) */
.stalker-fx::before {
  content: "";
  position: absolute;
  inset: -10% -30%;
  background-image:
    radial-gradient(46% 24% at 22% 92%, rgba(120, 132, 106, 0.22), transparent 70%),
    radial-gradient(40% 22% at 64% 94%, rgba(100, 112, 90, 0.18), transparent 70%),
    radial-gradient(32% 18% at 88% 88%, rgba(90, 100, 80, 0.15), transparent 70%);
  background-size: 1200px 700px, 1400px 800px, 1000px 650px;
  background-repeat: repeat-x;
  animation: fogDrift 28s linear infinite;
}
/* Зарево выброса на горизонте — заметно пульсирует */
.stalker-fx::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(52% 36% at 55% 100%, rgba(var(--toxic-rgb), 0.22), transparent 70%),
    radial-gradient(36% 26% at 20% 100%, rgba(var(--accent-rgb), 0.2), transparent 70%);
  animation: giftPulse 6s ease-in-out infinite alternate;
}
/* Мягкая виньетка по краям — контент по центру читается, края Зоны открыты */
.stalker-fx .fx-shade {
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 100% at 50% 40%, rgba(5, 6, 4, 0) 40%, rgba(5, 6, 4, 0.5) 100%);
}
/* Молнии, луна, облака, колесо, аномалии, птицы — всё анимируется внутри /bg/zone.svg */
@keyframes fogDrift {
  from { background-position: 0 0, 0 0, 0 0; }
  to { background-position: 1200px 0, 1400px 0, 1000px 0; }
}
@keyframes giftPulse {
  from { opacity: 0.45; }
  to { opacity: 1; }
}



/* Виньетка и все слои эффектов — в .stalker-fx; дополнительное затемнение
   поверх контента не нужно, панели и так тёмные. */











/* --------------------------------------------------------------------------
   Скроллбары
   -------------------------------------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.03); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.35), rgba(var(--accent-rgb), 0.15));
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(var(--accent-rgb), 0.6); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* --------------------------------------------------------------------------
   Навигация — ржавая полоса
   -------------------------------------------------------------------------- */
.tabs,
.top-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 14px;
  margin: 0;
  background: rgba(29, 32, 26, 0.6);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--border-strong);
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
}

.tab {
  position: relative;
  padding: 13px 14px;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease, text-shadow 0.2s;
  text-decoration: none;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.3); }
.tab a { color: inherit !important; text-decoration: none !important; display: block; }
.tab.active {
  color: var(--accent);
  text-shadow: 0 0 16px rgba(var(--accent-rgb), 0.55);
}
.tab::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--toxic));
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.9);
  opacity: 0;
  transform: scaleX(0.5);
  transition: opacity 0.25s, transform 0.25s;
}
.tab.active::after { opacity: 1; transform: scaleX(1); }

/* Бренд-лого */
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-right: 16px;
  padding: 12px 6px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  white-space: nowrap;
  color: var(--accent);
  text-shadow: 0 0 14px rgba(var(--accent-rgb), 0.35), 0 1px 0 rgba(0, 0, 0, 0.8);
}
.brand svg { flex-shrink: 0; filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), 0.5)); }
.brand a, .brand span, .brand h1 { color: inherit !important; text-decoration: none !important; }
.brand h1, .head .t, .chart-title .t { margin: 0; font-size: inherit; font-weight: inherit; line-height: inherit; }

/* --------------------------------------------------------------------------
   Каркас
   -------------------------------------------------------------------------- */
main { padding: 22px; max-width: 920px; margin: 0 auto; }

.tabview { display: none; animation: fadeIn 0.3s ease; }
.tabview.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.panel {
  background: linear-gradient(180deg, rgba(18, 21, 16, 0.72), rgba(14, 16, 12, 0.55));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
  transition: border-color 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.panel::before {
  content: "";
  position: absolute;
  top: 0; left: 16px; right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.7), transparent);
  opacity: 0.8;
}
.panel:hover { border-color: var(--border-strong); }

/* Заголовки панелей — «выбитая» табличка */
.panel > h2,
.stats-panel-top h2,
.stats-hist-screen-head h2,
h3.panel-title {
  margin: 0 0 12px;
  color: var(--accent);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-weight: 800;
  text-shadow: 0 0 18px rgba(var(--accent-rgb), 0.3), 0 1px 0 rgba(0, 0, 0, 0.8);
}

.row { display: flex; gap: 8px; }
/* Инпут внутри .row тянется на всю ширину, кнопка очистки прижимается вправо. */
.row > input { flex: 1; min-width: 0; }

/* --------------------------------------------------------------------------
   Поля, селекты, кнопки
   -------------------------------------------------------------------------- */
input, select, textarea {
  font-size: 14px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(8, 10, 8, 0.55);
  color: var(--text);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14), 0 0 14px rgba(var(--accent-rgb), 0.2);
  background: rgba(10, 12, 10, 0.7);
}
input::placeholder { color: var(--muted); opacity: 0.7; }

button {
  font-size: 14px;
  padding: 8px 14px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(180deg, rgba(213, 149, 63, 0.9), rgba(192, 127, 46, 0.85));
  color: #16130a;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease, background 0.2s ease;
  white-space: nowrap;
  line-height: 1;
}
button:hover { filter: brightness(1.08); box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.22); transform: translateY(-1px); }
button:active { transform: translateY(0) scale(0.98); }
button:disabled { opacity: 0.45; cursor: default; transform: none !important; box-shadow: none !important; filter: none !important; }

button.ghost,
button.btn-sm,
.modal button.ghost {
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  box-shadow: none;
  min-height: 34px;
  padding: 6px 12px;
}

/* Плавающая кнопка «наверх»: скрыта, пока не прокрутили страницу вниз. */
.scroll-top-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  justify-content: center;
  font-size: 20px;
  border-radius: 50%;
  background: rgba(18, 21, 16, 0.85);
  color: var(--text);
  border: 1px solid var(--accent);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 50;
}
.scroll-top-btn.show { opacity: 1; visibility: visible; transform: none; }
.scroll-top-btn:hover { border-color: var(--accent); color: var(--accent); }
button.ghost:hover,
button.btn-sm:hover,
.modal button.ghost:hover { color: var(--text); border-color: rgba(var(--accent-rgb), 0.6); background: rgba(var(--accent-rgb), 0.07); box-shadow: none; }

/* Кнопка ручного обновления вкладки: иконка крутится во время загрузки. */
.refresh-btn .ico { display: inline-block; }
.refresh-btn.refreshing { opacity: 0.7; cursor: default; }
.refresh-btn.refreshing .ico { animation: spin 0.8s linear infinite; }

/* Кнопка «×» для быстрой очистки поискового поля. */
.search-clear {
  flex: 0 0 auto;
  width: 38px;
  min-height: 38px;
  padding: 0;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border-strong);
}
.search-clear:hover { color: var(--text); border-color: var(--accent); }

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* --------------------------------------------------------------------------
   Загрузка / ошибки
   -------------------------------------------------------------------------- */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row { display: flex; align-items: center; gap: 8px; padding: 10px 8px; color: var(--muted); font-size: 13px; }
.error-msg { color: var(--danger); padding: 10px 8px; font-size: 13px; }
.empty { color: var(--muted); padding: 12px; }

/* --------------------------------------------------------------------------
   Тост-уведомления
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  background: rgba(18, 15, 9, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong);
  color: var(--text);
  pointer-events: auto;
  animation: toastIn 0.25s ease;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  text-align: center;
}
.toast.success { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.35); }
.toast.error { border-color: var(--danger); color: var(--danger); box-shadow: 0 0 22px rgba(207, 82, 66, 0.35); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* --------------------------------------------------------------------------
   Поиск и его результаты
   -------------------------------------------------------------------------- */
.search-results { margin-top: 8px; max-height: 320px; overflow-y: auto; }
.search-results .item,
.search-results > .item,
.top-results .item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}
.search-results .item:hover,
.top-results .item:hover { background: var(--card-hover); }
/* Подсветка строки при навигации с клавиатуры (↑/↓ в поиске). */
.search-results .item.kbd-active,
.top-results .item.kbd-active { background: rgba(var(--accent-rgb), 0.18); box-shadow: inset 2px 0 0 var(--accent); }
.search-results .item img,
.top-results .item img {
  width: 36px; height: 36px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
}
.search-results .item .name { flex: 1; font-weight: 500; }
.search-results .item .cat { color: var(--muted); font-size: 12px; }
.recent-hint { font-size: 11px; color: var(--accent); padding: 8px 10px 2px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; opacity: 0.8; }

/* Обводка иконок в цвет редкости (задаётся --rar инлайном) */
img.icon-ring,
.item img.icon-ring,
.prow img.icon-ring,
.rule img.rar-ring {
  border: 1.5px solid var(--rar, transparent) !important;
  box-shadow: 0 0 8px 0 var(--rar, transparent) !important;
  border-radius: 6px;
}
.rar-rainbow {
  position: relative;
  display: inline-flex;
  padding: 2px;
  border-radius: 6px;
  background: linear-gradient(135deg, #ffffff 0%, #ffffff 16.66%, #4ade80 16.66%, #4ade80 33.33%, #60a5fa 33.33%, #60a5fa 50%, #ec4899 50%, #ec4899 66.66%, #ef4444 66.66%, #ef4444 83.33%, #facc15 83.33%, #facc15 100%);
}
.rar-rainbow::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: inherit;
  filter: blur(3px);
}
.rar-rainbow img { position: relative; z-index: 1; width: 36px; height: 36px; object-fit: contain; background: rgba(0, 0, 0, 0.55); border-radius: 5px; }

/* --------------------------------------------------------------------------
   Кнопки действий в строках и бейджи
   -------------------------------------------------------------------------- */
.trackBtn,
.pickBtn,
.trackBtnOrange {
  background: linear-gradient(180deg, rgba(205, 113, 53, 0.9), rgba(173, 83, 24, 0.85)) !important;
  color: #1d1206 !important;
  border: none !important;
  cursor: pointer;
  font-weight: 700;
  padding: 7px 14px;
  min-height: 34px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.trackBtn:hover, .pickBtn:hover, .trackBtnOrange:hover { filter: brightness(1.08); box-shadow: 0 4px 16px rgba(var(--warning-rgb), 0.35); }
.trackBtnOrange.tracked { background: linear-gradient(180deg, rgba(170, 185, 78, 0.9), rgba(130, 145, 58, 0.85)) !important; color: #141705 !important; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.item .tracked { color: var(--toxic); font-size: 13px; font-weight: 700; flex: 0 0 auto; text-shadow: 0 0 10px rgba(var(--toxic-rgb), 0.5); }

.badge-upg,
.prow .dupgrade {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #eec97a;
  background: rgba(213, 149, 63, 0.12);
  border: 1px solid rgba(213, 149, 63, 0.45);
  border-radius: 5px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.2);
}

/* --------------------------------------------------------------------------
   Правила отслеживания и перебитий
   -------------------------------------------------------------------------- */
.rule {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}
.rule:last-child { border-bottom: 1px solid transparent; }
.rule:hover { background: var(--card-hover); }
.rule img {
  width: 40px; height: 40px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 8px;
  padding: 2px;
}
.rule .info { flex: 1; min-width: 0; }
.rule .sub { color: var(--muted); font-size: 12px; }
.rule .dragHandle { flex: 0 0 auto; color: var(--muted); cursor: grab; font-size: 20px; line-height: 1; user-select: none; padding: 0 2px; }
.rule .actBtn {
  flex: 0 0 auto; width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border-strong);
  cursor: pointer; font-size: 16px; font-weight: 700; line-height: 1;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, color 0.15s;
}
.rule .actBtn:hover { border-color: rgba(var(--accent-rgb), 0.6); color: var(--accent); }
.rules-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.rules-meta .warn { color: #eec97a; }

/* --------------------------------------------------------------------------
   Модальные окна
   -------------------------------------------------------------------------- */
.modal-mask {
  position: fixed; inset: 0;
  background: radial-gradient(120% 120% at 50% 50%, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.78));
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: none; align-items: center; justify-content: center;
  z-index: 80;
}
.modal-mask.open { display: flex; animation: fadeIn 0.2s ease; }
/* Блокировка прокрутки фона, пока открыто модальное окно или полноэкранная
   «История перепродаж». Класс вешает вспомогательный скрипт (index.html/item.html). */
body.modal-open { overflow: hidden; }
 .modal {
   background: linear-gradient(180deg, rgba(26, 22, 13, 0.82), rgba(18, 15, 8, 0.66));
   border: 1px solid var(--border-strong);
   border-radius: 12px;
   padding: 20px;
   width: 320px;
   backdrop-filter: blur(12px);
   -webkit-backdrop-filter: blur(12px);
   max-width: 92vw;
   box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
   position: relative;
 }
 .modal h3 { margin: 0 0 14px; font-size: 16px; color: var(--accent); letter-spacing: 0.4px; text-transform: uppercase; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.modal input, .modal select { width: 100%; }
.modal .note { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
 .modal .btns { display: flex; gap: 8px; margin-top: 18px; }
 .modal .btns button { flex: 1; }
 /* Переключатель языка (RU/EN) в окне входа */
 .auth-lang { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 4px; }
 .lang-btn { background: transparent; border: 1px solid #2a2e37; color: var(--muted); border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12px; font-weight: 600; }
 .lang-btn.active { color: var(--accent); border-color: var(--accent); }
 .auth-switch { margin-top: 14px; font-size: 13px; color: var(--muted); text-align: center; }
 .link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; font-weight: 600; padding: 0; text-decoration: underline; }
.modal button.primary { background: linear-gradient(180deg, #cd7135, #ad5318); color: #1d0c02; box-shadow: 0 4px 14px rgba(var(--warning-rgb), 0.28); }
.modal button.primary.danger-confirm { background: linear-gradient(180deg, #d45341, #b13a2c); color: #200706; box-shadow: 0 4px 14px rgba(207, 82, 66, 0.35); }
    .modal-md { width: 380px; }
    /* Поиск предмета внутри модалки условий отслеживания */
    .msearch-wrap { position: relative; margin-bottom: 4px; }
    .m-item-label { font-size: 12px; color: var(--accent); margin: 4px 0 0; word-break: break-word; }
    .m-item-label:empty { display: none; }
    .msearch-results {
      position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
      margin-top: 4px; max-height: 280px; overflow-y: auto;
      background: var(--card); border: 1px solid #2a2e37; border-radius: 10px;
      box-shadow: 0 10px 30px rgba(0,0,0,0.5); padding: 4px;
    }
    .msearch-results:empty { display: none; }
    .msearch-results .msearch-item {
      display: flex; align-items: center; gap: 8px; padding: 6px 8px;
      border-radius: 8px; cursor: pointer;
    }
    .msearch-results .msearch-item:hover { background: rgba(255,255,255,0.06); }
    .msearch-results .msearch-item.kbd-active { background: rgba(var(--accent-rgb), 0.18); box-shadow: inset 2px 0 0 var(--accent); }
    .msearch-results .msearch-item img {
      width: 28px; height: 28px; object-fit: contain; border-radius: 6px; flex: none; background: #000;
    }
    .msearch-results .msearch-item .name { font-size: 13px; }
    .msearch-results .msearch-item .cat { font-size: 11px; color: var(--muted); margin-left: auto; }
    .msearch-results .empty, .msearch-results .error-msg { padding: 8px; font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Чипсы-фильтры
   -------------------------------------------------------------------------- */
.popular-filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.popular-filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-label { font-size: 11px; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; font-weight: 700; }

.chip {
  display: inline-flex; align-items: center;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s, background 0.15s;
}
.chip:hover { border-color: rgba(var(--accent-rgb), 0.6); color: var(--text); background: rgba(var(--accent-rgb), 0.05); }
.chip.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  font-weight: 700;
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.25);
}
.chip[data-rar].active { color: var(--rar); border-color: var(--rar); background: rgba(255, 255, 255, 0.04); box-shadow: 0 0 14px var(--rar); }
.chip.dban.active { color: var(--danger); border-color: var(--danger); box-shadow: 0 0 14px rgba(207, 82, 66, 0.35); }
.chip.dug { padding: 3px 10px; font-size: 12px; }

/* --------------------------------------------------------------------------
   Список «Популярное»
   -------------------------------------------------------------------------- */
.plist { display: flex; flex-direction: column; gap: 8px; }
/* Свежая продажа в «Популярном»: краткое мигание строки, у которой счётчик
   продаж вырос с прошлого опроса (новые лоты в периоде). Аналог .drow-new. */
.prow.plist-new { animation: plistNew 2s ease-out; }
@keyframes plistNew {
  from { background-color: rgba(34, 197, 94, 0.22); }
  to { background-color: transparent; }
}
/* Счётчик строк, отрисованных пошагово (догрузка списка скроллом). */
.plist-more {
  text-align: center; padding: 8px 0;
  color: var(--muted); font-size: 12px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
}
/* Кнопка «Показать ещё» в «Популярном» (index.html) — порционная догрузка топа. */
button.plist-more {
  display: block; width: 100%; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px; font-size: 13px; font-weight: 600;
  box-shadow: none; min-height: 40px;
  transition: color 0.15s, border-color 0.15s;
}
button.plist-more:hover { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.6); background: rgba(var(--accent-rgb), 0.04); }
/* Кнопка догрузки следующей порции лотов аукциона (item.html) */
button.lots-more {
  display: block; width: 100%; margin: 10px 0 4px;
  background: transparent; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px; font-size: 13px; font-weight: 600;
  box-shadow: none; min-height: 40px;
  transition: color 0.15s, border-color 0.15s;
}
button.lots-more:hover { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.6); background: rgba(var(--accent-rgb), 0.04); }
.prow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008)), rgba(14, 16, 12, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.prow:hover { border-color: var(--accent); box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.14); transform: translateY(-1px); }
.prow .rank { width: 32px; text-align: center; font-weight: 800; color: var(--accent); flex-shrink: 0; text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.4); }
.prow img { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; border-radius: 6px; background: rgba(0, 0, 0, 0.45); }
.prow .pname { flex: 1; min-width: 0; font-weight: 600; }
.prow .pcat { font-size: 12px; color: var(--muted); }
.prow .count { font-weight: 800; color: var(--accent); text-align: right; white-space: nowrap; text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.4); }
.pchart {
  flex: 0 0 auto;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.pchart:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.25); }

/* --- Скидки: строки результатов --- */
.prow.drow { cursor: default; gap: 0; align-items: center; }
.prow.drow:hover { border-color: var(--border-strong); transform: none; box-shadow: none; }
.prow.drow > .dname, .prow.drow > .dtimes, .prow.drow > .dprice, .prow.drow > .dprofit { border-left: 1px solid var(--border); padding-left: 12px; }
.prow .dname { flex: 1; min-width: 0; font-weight: 600; }
.prow .dcat { font-size: 12px; color: var(--muted); }
.prow .dprofit { font-weight: 800; color: var(--accent); white-space: nowrap; line-height: 1; text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.4); }
.prow .dprice { color: var(--muted); font-size: 12px; white-space: nowrap; line-height: 1; }
.prow .ddrop {
  font-size: 11px; padding: 2px 7px; border-radius: 999px; margin-left: 10px; margin-right: 8px;
  background: rgba(207, 82, 66, 0.13);
  color: var(--danger);
  font-weight: 800;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(207, 82, 66, 0.3);
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.prow .dcopy {
  flex: 0 0 30px; width: 30px; height: 30px; min-height: 30px; max-height: 30px; aspect-ratio: 1 / 1; box-sizing: border-box;
  align-self: center; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  cursor: pointer; font-size: 14px; font-weight: 700; padding: 0;
  transition: color 0.15s, border-color 0.15s;
}
.prow .dcopy:hover { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.6); }
.prow .dtimes { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); white-space: nowrap; text-align: right; align-items: flex-end; }
.prow .dtimes .dt-found { color: var(--toxic); }
.prow .dtimes .dt-start { color: var(--muted); }
/* Свежая находка сканера (новый лот в «Выгодные лоты»): краткое мигание
   заливкой, чтобы пользователь сразу заметил появление лота. */
.prow.drow.drow-new { animation: drowNew 1.8s ease-out; }
@keyframes drowNew {
  from { background-color: rgba(34, 197, 94, 0.22); }
  to { background-color: transparent; }
}

/* Шапка колонок сканера */
.dhead { display: flex; align-items: flex-end; gap: 12px; padding: 8px 12px 0; }
.dhead .dhead-rank { width: 32px; flex-shrink: 0; }
.dhead .dhead-icon { width: 40px; flex-shrink: 0; }
.dhead .dhead-name { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.dhead .dhead-price, .dhead .dhead-profit, .dhead .dhead-drop, .dhead .dhead-sort, .dhead .dhead-upg { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; white-space: nowrap; }
.dhead .filter-pair { display: flex; gap: 4px; }
.dhead select, .dhead input[type="search"], .dhead input[type="number"], .dhead input[type="text"] {
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
}
.dhead input[type="search"] { width: 100%; box-sizing: border-box; }

/* --------------------------------------------------------------------------
   Вкладка «Статистика» (учёт перепродаж)
   -------------------------------------------------------------------------- */
.stats-panel-head h3 { margin: 0 0 12px; font-size: 14px; }
.stats-lots-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 16px 0 12px; }
.stats-cols { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 14px; font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: 0.3px; }
.stats-cols .arrow-sep {
  font-size: 18px;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.5);
}

.stats-buy {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px; padding: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008)), rgba(14, 16, 12, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.stats-buy .buy-name { flex: 1; min-width: 120px; font-weight: 600; }
.stats-buy .buy-cat { font-size: 12px; color: var(--muted); font-weight: 400; }
.stats-buy input[type="text"] { width: 160px; }
.stats-buy select { padding: 8px 10px; font-size: 13px; }
.stats-buy .buy-art { display: flex; gap: 8px; flex-wrap: wrap; }

.lot {
  display: flex; align-items: center; gap: 8px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008)), rgba(14, 16, 12, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  flex-wrap: wrap;
  transition: border-color 0.18s ease;
}
.lot:hover { border-color: var(--border-strong); }
.lot .l-half { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 240px; }
.lot .l-half.sell-side { justify-content: flex-end; }
.lot .l-half img { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: rgba(0, 0, 0, 0.45); flex-shrink: 0; }
.lot .l-half .l-info { flex: 1 1 auto; min-width: 0; }
.lot .l-half .l-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lot .l-half .l-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lot .l-sell { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.lot .sell-input { width: 130px; font-size: 13px; padding: 7px 9px; flex: 0 0 auto; }
.lot .sell-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14); }
.lot .btn-sell { background: linear-gradient(180deg, #d5953f, #c07f2e); color: #1c1204; font-weight: 800; font-size: 13px; padding: 8px 14px; border-radius: var(--radius-sm); white-space: nowrap; flex: 0 0 auto; }
.lot .l-actions { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.lot .l-actions .btn-sm { padding: 5px 10px; font-size: 12px; font-weight: 600; }
.lot .l-actions .btn-sm.danger { border-color: rgba(207, 82, 66, 0.45); color: var(--danger); }
.lot .l-actions .btn-sm.danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(207, 82, 66, 0.08); }

.lot .l-actions .actBtn,
.hist-row .h-actions .actBtn {
  flex: 0 0 auto; width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border-strong);
  cursor: pointer; font-size: 15px; font-weight: 700; line-height: 1;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, color 0.15s;
}
.lot .l-actions .actBtn:hover,
.hist-row .h-actions .actBtn:hover { border-color: rgba(var(--accent-rgb), 0.6); color: var(--accent); }
.lot .l-actions .delBtn,
.hist-row .h-actions .delBtn {
  flex: 0 0 auto; width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--danger);
  border: 1px solid rgba(207, 82, 66, 0.5);
  cursor: pointer; font-size: 18px; font-weight: 700; line-height: 1;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, background 0.15s;
}
.lot .l-actions .delBtn:hover,
.hist-row .h-actions .delBtn:hover { border-color: var(--danger); background: rgba(207, 82, 66, 0.1); }

.stats-panel-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stats-panel-top h2 { margin: 0; font-size: 15px; }
.stats-hist-fab {
  position: relative; width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)), rgba(14, 16, 12, 0.6);
  border: 1px solid var(--border-strong);
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.stats-hist-fab:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.2); }
.stats-hist-fab.has-sales::after {
  content: attr(data-count);
  position: absolute; left: -9px; bottom: -9px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 50%;
  border: 1.5px solid var(--danger);
  background: rgba(13, 11, 7, 0.92);
  color: var(--danger);
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box;
  box-shadow: 0 0 10px rgba(207, 82, 66, 0.4);
}

.stats-hist-screen {
  position: fixed; inset: 0; z-index: 60;
  background:
    radial-gradient(800px 400px at 80% -10%, rgba(var(--accent-rgb), 0.08), transparent 60%),
    var(--bg);
  display: flex; flex-direction: column;
  padding: 24px; overflow-y: auto;
}
.stats-hist-screen-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.stats-hist-screen-head h2 { margin: 0; font-size: 18px; flex: 1; }
.stats-hist-screen-head .hist-back {
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)), rgba(14, 16, 12, 0.6);
  color: var(--text);
  border: 1px solid var(--border-strong);
  cursor: pointer; font-size: 20px; line-height: 1;
  border-radius: 10px; font-weight: 700; flex: 0 0 auto;
  transition: border-color 0.15s, color 0.15s;
}
.stats-hist-screen-head .hist-back:hover { border-color: var(--accent); color: var(--accent); }
.stats-hist-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.stats-hist-controls .hist-period-lbl { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.stats-hist-controls input[type="number"] { width: 80px; font-size: 13px; padding: 6px 8px; }
.stats-hist-controls .btn-sm.danger { border-color: rgba(207, 82, 66, 0.45); color: var(--danger); }
.stats-hist-controls .btn-sm.danger:hover { border-color: var(--danger); background: rgba(207, 82, 66, 0.08); }

.hist-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.hist-row:last-child { border-bottom: none; }
.hist-row img { width: 30px; height: 30px; object-fit: contain; border-radius: 6px; }
.hist-row .h-name { flex: 0 1 auto; min-width: 0; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.hist-row .h-meta { flex: 1 1 auto; min-width: 140px; font-size: 12px; color: var(--muted); }
.hist-row .h-profit { flex: 0 0 auto; font-weight: 800; white-space: nowrap; }
.hist-row .h-actions { display: flex; gap: 4px; align-items: center; flex: 0 0 auto; margin-left: auto; }
.hist-row .h-actions .btn-sm { padding: 3px 8px; font-size: 11px; font-weight: 600; }
.hist-row .h-actions .btn-sm.danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(207, 82, 66, 0.08); }

/* Сводка KPI */
.stats-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 1200px) { .stats-kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008)), rgba(14, 16, 12, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.2s ease;
}
.kpi:hover { border-color: var(--border-strong); }
.kpi .v { font-size: 16px; font-weight: 800; line-height: 1.25; }
.kpi .l { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.kpi.pos { border-color: rgba(var(--toxic-rgb), 0.35); box-shadow: inset 0 0 0 1px rgba(var(--toxic-rgb), 0.08), 0 0 18px rgba(var(--toxic-rgb), 0.07); }
.kpi.neg { border-color: rgba(207, 82, 66, 0.35); box-shadow: inset 0 0 0 1px rgba(207, 82, 66, 0.08); }
.kpi .v.pos-txt { color: var(--toxic); text-shadow: 0 0 14px rgba(var(--toxic-rgb), 0.35); }
.kpi .v.neg-txt { color: var(--danger); }

/* ==========================================================================
   СТРАНИЦА ПРЕДМЕТА (item.html)
   ========================================================================== */
#icon, .chart-head img { transition: box-shadow 0.2s ease; }

.head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.head img {
  width: 64px; height: 64px;
  object-fit: contain;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.35));
  border-radius: 10px;
  box-shadow: 0 0 18px var(--rar, rgba(var(--accent-rgb), 0.12));
}
.head img#icon, .chart-head img.chart-icon.ringed {
  border: 1.5px solid var(--rar, transparent);
  box-shadow: 0 0 16px 0 var(--rar, rgba(var(--accent-rgb), 0.2));
}
.head .t { font-size: 19px; font-weight: 800; letter-spacing: 0.2px; color: var(--text); }
.head .c { color: var(--muted); font-size: 13px; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.searchbar { margin-bottom: 16px; }
.searchbar input { width: 100%; }

.filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; margin: 0 0 12px; }
.filters label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; letter-spacing: 0.4px; text-transform: uppercase; font-weight: 700; }

/* Строка лота аукциона — разделитель и свечение в цвет редкости */
.lots { max-height: 70vh; overflow-y: auto; scrollbar-width: thin; position: relative; }
.lot {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--rar, rgba(127, 127, 127, 0.22)) 55%, transparent);
  box-shadow: inset 0 -6px 10px -8px var(--rar, transparent);
  border-radius: 6px;
  transition: background 0.15s ease;
}
.lot:last-child { border-bottom: none; box-shadow: none; margin-bottom: 0; }
.lot:hover { background: rgba(255, 255, 255, 0.025); }
.lot .lotIcon {
  width: 40px; height: 40px; object-fit: contain;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 6px;
  border: 1.5px solid var(--rar, transparent);
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.lot .lotIcon::after {
  content: "";
  position: absolute; inset: -6px; z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--rar, transparent) 0%, transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}
.lot .priceWrap { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.lot .price {
  color: var(--warning);
  font-weight: 800;
  font-size: 14px;
  text-shadow: 0 0 12px rgba(var(--warning-rgb), 0.5);
}
.lot .cur { color: var(--muted); font-size: 11px; }
.lot .upg {
  margin-left: 10px; font-size: 12px; font-weight: 700;
  color: #eec97a;
  background: rgba(213, 149, 63, 0.12);
  border: 1px solid rgba(213, 149, 63, 0.45);
  border-radius: 5px;
  padding: 1px 7px;
  flex: 0 0 auto;
}
.lot .timeLeft { margin-left: 10px; font-size: 11px; font-weight: 600; color: var(--muted); flex: 0 0 auto; white-space: nowrap; }
.lot .timeLeft.hot { color: var(--warning); }
.lot .timeLeft.expired { color: var(--danger); }

.refresh-line { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; font-size: 13px; color: var(--muted); }
.refresh-line button { background: transparent; color: var(--muted); border: 1px solid var(--border-strong); padding: 5px 12px; font-size: 12px; cursor: pointer; box-shadow: none; }
.refresh-line button:hover { border-color: var(--accent); color: var(--accent); }
.refresh-line button:disabled { opacity: 0.5; cursor: default; }

.price-stats { font-size: 13px; color: var(--muted); margin: -2px 0 10px; }
.price-stats b { color: var(--text); font-weight: 700; }

.scroll-top {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(180deg, #d5953f, #c07f2e);
  color: #1c1204; border: none; font-size: 20px; cursor: pointer;
  box-shadow: 0 6px 22px rgba(var(--accent-rgb), 0.45);
  display: none; align-items: center; justify-content: center;
  transition: opacity 0.2s, transform 0.2s;
}
.scroll-top:hover { transform: scale(1.12); }
.scroll-top.show { display: flex; }

/* Оверлей «Загрузка…» поверх списка лотов */
.spinner-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(13, 11, 7, 0.72);
  backdrop-filter: blur(3px);
  color: var(--muted); font-size: 13px;
  border-radius: inherit;
}

/* ==========================================================================
   СТРАНИЦА ГРАФИКА (history_chart.html)
   ========================================================================== */
.top-search-wrap { position: relative; margin: 12px 24px 0; flex: 1; max-width: 480px; }
.top-search { font-size: 14px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: rgba(0, 0, 0, 0.42); color: var(--text); width: 100%; }
.top-results {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 260px; max-height: 60vh; overflow-y: auto;
  background: rgba(15, 13, 8, 0.97);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 6px;
  display: none; z-index: 30;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.top-results.show { display: block; animation: fadeIn 0.15s ease; }
.top-results .recent-hint { font-weight: 700; }
.top-results .name { font-size: 14px; }
.top-results .cat { color: var(--muted); font-size: 12px; }

.chart-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.chart-head img { width: 64px; height: 64px; object-fit: contain; background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.35)); border-radius: 10px; margin-left: 12px; }
.chart-title .t { font-size: 19px; font-weight: 800; letter-spacing: 0.2px; color: var(--text); }
.chart-title .c { color: var(--muted); font-size: 13px; }

.chart-filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: flex-end; margin-bottom: 16px; padding-right: 24px; }
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip.active { box-shadow: 0 0 14px var(--rar, rgba(var(--accent-rgb), 0.25)); }

.chart-wrap {
  position: relative;
  width: 100%;
  height: calc(100vh - 340px);
  min-height: 220px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.005)), var(--chart-bg);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
}
#tvchart { position: absolute; inset: 0; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }

.chart-legend-inline { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; }
.chart-legend-inline .lg { display: flex; align-items: center; gap: 6px; color: var(--text); }
.chart-legend-inline .lg .sw { width: 12px; height: 3px; border-radius: 2px; }
.chart-count-inline {
  font-size: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  margin: 12px 24px;
  align-self: center;
  width: fit-content;
}
.chart-loading {
  position: absolute; left: 10px; bottom: 10px;
  font-size: 12px; color: #facc15;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 10px;
  border-radius: 8px;
  pointer-events: none; z-index: 5;
  display: none;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.15);
}

/* Адаптивность */
@media (max-width: 640px) {
  main { padding: 14px; }
  /* Раньше 7 вкладок + бренд + тема/аккаунт в одну строку не помещались и
     правые вкладки уезжали за край sticky-навбара на узких экранах. Разрешаем
     перенос на новую строку, чтобы каждый таб оставался доступным. */
  .tabs, .top-tabs { padding: 0 6px; flex-wrap: wrap; row-gap: 0; }
  .tab { padding: 12px 10px; font-size: 12px; letter-spacing: 0.4px; }
  .brand { margin-right: 6px; font-size: 13px; }
  .brand svg { display: none; }
}
