/* css/base.css
   Базовые стили: сброс, контейнер, общие элементы (карточки, кнопки, формы, вкладки, админ-таблицы)
   Вынесено из style.css без изменения содержимого правил. */

* { margin: 0; padding: 0; box-sizing: border-box; }
/* overflow-x: clip, не hidden — принципиально: hidden заставляет браузер
   считать overflow-y тоже не-visible (авто-сцепка осей в спеке CSS Overflow),
   а это ломает position:sticky у ЛЮБОГО потомка на всей странице (в т.ч.
   .header, см. css/header.css) — sticky-элемент перестаёт цепляться за
   вьюпорт и просто уезжает вместе с контентом при скролле. clip даёт то же
   обрезание по горизонтали (см. комментарий про карусель ниже), но не
   создаёт скролл-контейнер и не трогает вторую ось — sticky снова работает
   от реального вьюпорта. Реальный случай 2026-07-15: шапка сайта была
   объявлена sticky, но фактически скроллилась вместе со страницей. */
/* scrollbar-gutter: stable — место под вертикальную полосу резервируется
   всегда. Без него короткая страница (или короткая вкладка кабинета) убирает
   полосу, ширина вьюпорта скачком меняется на её толщину (замер: 15px), и
   вся страница прыгает по горизонтали при каждом переключении вкладки. */
html { overflow-x: clip; scrollbar-gutter: stable; }
/* Тёмная тема полос прокрутки. Раньше не задавалась вообще: в модалке
   чекаута, в дропдауне поиска и в списке уведомлений браузер рисовал светлую
   системную полосу поверх скруглённого угла тёмной панели. Точечные
   scrollbar-width:none (css/quickbuy.css, css/redesign-profile.css) имеют
   более узкие селекторы и продолжают прятать полосу там, где так задумано. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color-strong) transparent;
}
/* Skip-ссылка (index.html, первый элемент <body>): не видна, пока не получит
   фокус с клавиатуры, затем выезжает поверх шапки. Не .sr-only — тому нельзя
   вернуть видимость по :focus, у него clip-path режет содержимое. */
.skip-link {
  position: fixed;
  top: 8px;
  left: -9999px;
  z-index: 10000;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--rd-panel, #16171d);
  border: 1px solid var(--rd-gold, #d9b25f);
  color: var(--rd-text, #e6e7eb);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus {
  left: 8px;
}

/* Скрыто визуально, но остаётся в дереве доступности — для подписей, которые
   не должны занимать место на экране (например текст кнопок шапки на узких
   ширинах, см. .btn-text в css/header.css). Именно этот набор свойств, а не
   display:none/visibility:hidden — те выкидывают элемент из дерева
   доступности вместе с его текстом, и кнопка остаётся безымянной. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
body {
  background: var(--bg-color); color: var(--text-color);
  font-family: var(--font-family, 'Inter', system-ui, sans-serif); min-height: 100vh;
  /* На macOS текст рендерится жирнее задуманного дизайном — сглаживание
     задаём один раз на корне, чтобы накрыть весь текст сразу. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* grid auto/1fr/auto прижимает футер к низу: три элемента в потоке
     (header, #appMain, footer) ложатся на три трека, 1fr на #appMain
     растягивает середину, футер уезжает вниз даже при коротком контенте.
     Модалки/оверлеи из потока выпадают (position:fixed) и треки не занимают.
     grid-template-columns: minmax(0,1fr) — ОБЯЗАТЕЛЬНО: без него неявная
     колонка по умолчанию `auto` и растягивается по max-content содержимого
     (карусель быстрой покупки), раздувая всю страницу шире вьюпорта на
     мобильных. minmax(0,1fr) держит колонку строго по ширине вьюпорта. */
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  overflow-x: clip;
}
button, input, select, textarea { font-family: inherit; }
/* width:100% здесь обязателен, а не косметика: margin:0 auto на grid-элементе
   (как и на flex-элементе) отключает stretch-выравнивание, и тогда браузер
   считает ширину по контенту (max-content, до max-width) вместо ширины трека.
   Карусель быстрой покупки достаточно "широкая" по контенту, чтобы раздуть
   контейнер шире вьюпорта на мобильных — отсюда был горизонтальный скролл и
   "разъезд" всех блоков. Явный width:100% фиксит ширину по вьюпорту, а
   max-width:1100 + margin:auto по-прежнему центрируют контейнер на десктопе. */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 20px; }


/* ===== ОСТАЛЬНЫЕ СТИЛИ (общие) ===== */
.page { display: none; }
.page.active {
  display: block;
  animation: pageEnter 0.28s ease;
}
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .page.active { animation: none; }
}

/* ===== ФОНОВЫЕ ЧАСТИЦЫ =====
   Декоративный слой позади всего контента: position:fixed + z-index:-1
   рисуется поверх фона <body> (он всегда в самом низу канвы), но под любым
   обычным (непозиционированным) контентом — так частицы видны только в
   промежутках между непрозрачными карточками/шапкой, не мешая кликам
   (pointer-events:none) и не требуя JS-анимации (только transform/opacity —
   дёшево для GPU, никакого requestAnimationFrame). Сами span-элементы
   создаёт js/shared/particles.js один раз при старте. */
.particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.particles span {
  position: absolute;
  bottom: -10px;
  border-radius: 50%;
  background: var(--primary-color);
  opacity: 0;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0% { transform: translateY(0) scale(1); opacity: 0; }
  10% { opacity: 0.5; }
  90% { opacity: 0.25; }
  100% { transform: translateY(-100vh) scale(0.8); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .particles { display: none; }
}

/* ===== ПОЯВЛЕНИЕ БЛОКОВ ГЛАВНОЙ =====
   Общий keyframe для каскадного reveal карточек/виджетов на главной —
   .game-card использует его тут же, .quick-buy-frame — в css/quickbuy.css.
   fill-mode:backwards держит элемент в состоянии "from" до старта задержки
   (иначе на миг мелькнёт полностью видимым до начала анимации). */
@keyframes heroEnter {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .game-card { transition: none; opacity: 1; transform: none; }
}

/* ===== ПОБУКВЕННЫЙ РЕВИЛ ЗАГОЛОВКА =====
   js/shared/textReveal.js оборачивает каждую букву в <span> и добавляет
   класс reveal-text на сам заголовок; анимация — только opacity/transform. */
.reveal-text span {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  animation: letterIn 0.35s ease forwards;
}
@keyframes letterIn {
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .reveal-text span { animation: none; opacity: 1; transform: none; }
}
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px; margin-top: 20px;
}
@media (min-width: 1200px) {
  #homePage #gamesGrid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
.game-card {
  /* Сброс браузерных стилей <button> (карточка была кликабельным <div>, см.
     js/shared/navigation.js): шрифт и выравнивание обязательно наследуем —
     иначе .game-title/.game-count с размерами в em считались бы от дефолтного
     шрифта кнопки (~13px), а текст в оверлее уехал бы по центру. */
  font: inherit;
  color: inherit;
  text-align: left;
  border: 0;
  display: block;
  width: 100%;
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  padding: 4px;
  isolation: isolate;
  cursor: pointer;
  background: var(--border-color);
  /* Scroll-reveal (js/shared/cardReveal.js) вместо анимации по факту
     рендера — карточка стартует скрытой/сдвинутой и проявляется transition'ом,
     когда IntersectionObserver добавляет .rd-card-visible при попадании в
     viewport (и сразу для верхнего ряда, видимого без скролла). transform
     в transition ниже — тот же список свойств, что и для hover-lift, чтобы
     не плодить два отдельных transition на одном элементе. */
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.game-card.rd-card-visible {
  opacity: 1;
  transform: translateY(0);
}
.game-card:hover { transform: translateY(-2px); background: var(--border-color-strong); }
/* Бегущая обводка при наведении — .rd-snake/.rd-snake-gold/.rd-snake-hover
   (css/redesign-motion.css), классы навешаны в js/shared/navigation.js.
   Старый ::before-механизм на quickBuySnake отсюда убран (Фаза 15.1,
   дедуп) — .game-card рендерится только на #homePage#gamesGrid, второй
   glow нигде больше не подключался. */
.game-card-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
}
/* Затемнение под подписью. Прежние стопы (0.85 / 0.5 на 55%) оставляли
   название карточки в слишком светлой зоне: на арте Mech Arena подпись
   ложилась прямо на вордмарк из картинки и читалась как двойной текст.
   Градиент удлинён и уплотнён в середине — сам арт сверху по-прежнему
   не затемняется. */
.game-card-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 40px 14px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.75) 45%, rgba(0,0,0,0.35) 75%, transparent 100%);
}
.game-title { font-size: 1.05em; color: #fff; margin-bottom: 4px; font-weight: 600; }
.game-count { font-size: 0.85em; color: rgba(255,255,255,0.85); display: flex; align-items: center; gap: 6px; }
.game-count-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success-color, #2ecc71);
  flex-shrink: 0;
}
.product-card {
  background: var(--surface-1); border-radius: 12px; padding: 25px 15px;
  text-align: center; border: 1px solid var(--border-color); transition: transform 0.15s, border-color 0.15s;
}
.product-card:hover { transform: translateY(-2px); box-shadow: none; border-color: var(--border-color-strong); }
.product-emoji { font-size: 2.5em; margin-bottom: 10px; }
.product-name { color: var(--text-color); font-weight: 600; margin-bottom: 8px; }
.product-price { font-size: 1.3em; color: var(--primary-color); font-weight: 700; margin-bottom: 15px; }
/* Легаси-базис кнопки. НЕ удалять: на витрине (#gamePage/#productDetailPage/
   #checkoutModal и т.п.) `.btn` намеренно переопределяется scoped-правилами
   редизайна (css/redesign-game-product.css, redesign-cart-checkout.css) —
   там это не «старый розовый», а золотая кнопка из дизайн-системы. Для новых
   отдельных кнопок вне этих scope используй `.rd-btn*` (css/redesign-settings.css).
   Фаза 15.1: см. docs/STYLE_CONSISTENCY_PLAN.md §4 F2. */
.btn {
  display: inline-block; background: var(--primary-color); border: none; color: white;
  padding: 10px 25px; border-radius: 8px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, transform 0.1s; font-size: 1em;
}
.btn:hover { background: var(--primary-color-hover); }
.btn:active { transform: scale(0.96); }
.btn:disabled { background: #444650; cursor: not-allowed; }
.btn-small { padding: 5px 15px; font-size: 0.85em; border-radius: 6px; }
.back-btn {
  background: none; border: 1px solid var(--border-color); color: var(--text-secondary);
  padding: 8px 20px; border-radius: 8px; cursor: pointer;
  margin-bottom: 20px; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.back-btn:hover { background: var(--surface-2); color: var(--text-color); border-color: var(--border-color-strong); }
.cart-list { margin-top: 20px; }
.cart-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface-1); padding: 15px; border-radius: 12px;
  margin-bottom: 10px; flex-wrap: wrap; gap: 10px;
}
.cart-item-info { flex: 1; min-width: 150px; }
.cart-item-name { font-weight: bold; color: var(--text-color); }
.cart-item-price { font-size: 0.9em; opacity: 0.8; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  background: var(--primary-color); border: none; color: white;
  width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; font-size: 1.2em; display: flex; align-items: center; justify-content: center;
}
.remove-btn { background: var(--border-color); border: none; color: white; padding: 8px 15px; border-radius: 8px; cursor: pointer; }
.remove-btn:hover { background: var(--primary-color); }
.cart-summary {
  margin-top: 20px; display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 15px;
}
/* tabular-nums: сумма пересчитывается на месте (изменение количества,
   промокод, удаление позиции) — пропорциональные цифры дёргали ширину. */
.cart-total { font-size: 1.5em; color: var(--text-color); font-weight: bold; font-variant-numeric: tabular-nums; }
/* В этой строке живут две разные вещи: нейтральный счётчик позиций ("3
   товара") и, когда скидка есть, расшифровка суммы. Зелёный статусный токен —
   только для второго случая, класс вешает js/core/cart.js. Раньше цвет был
   захардкожен (#00b894) и не совпадал ни с одним токеном палитры. */
.cart-discount { color: var(--rd-text-muted, #9aa0aa); font-size: 1em; margin-top: 5px; }
.cart-discount.cart-discount-applied { color: var(--rd-status-done, #00b894); }
.empty-cart-msg { text-align: center; opacity: 0.6; padding: 40px; }
.auth-form, .modal {
  max-width: 400px; margin: 40px auto;
  background: var(--surface-1); padding: 30px; border-radius: 12px; border: 1px solid var(--border-color);
}
.auth-form h2, .modal h2 { color: var(--text-color); margin-bottom: 20px; text-align: center; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; color: #ccc; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px; border-radius: 8px;
  border: 1px solid var(--border-color); background: var(--bg-color); color: white; font-size: 1em;
}
.form-group input:focus { border-color: var(--primary-color); outline: none; }
.form-footer { text-align: center; margin-top: 20px; }
.form-footer a { color: var(--primary-color); cursor: pointer; text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }
.profile-info {
  background: var(--surface-1); padding: 20px; border-radius: 16px;
  margin-bottom: 20px; display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 10px;
}
.loyalty-info { background: var(--surface-1); padding: 15px; border-radius: 12px; margin-bottom: 20px; }
.order-item { background: var(--surface-1); padding: 15px; border-radius: 12px; margin-bottom: 10px; }
.order-item p { margin: 3px 0; }
/* Цвета .status-new/.status-work/.status-done/.status-error/.status-cancel
   заданы только через #profilePage .status-* (css/redesign-profile.css) —
   единственное реальное место использования .status-badge (ordersTab.js).
   Раньше здесь же дублировались бare-классы с другими hex, что молча
   сталкивалось с одноимёнными .status-new/.status-error из блока
   .status-dropdown ниже (тот выигрывал по порядку каскада для любого не
   scoped-элемента) — удалено, а не переименовано, чтобы не тащить
   недостижимый код. */
.status-badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 0.85em; font-weight: bold; margin-left: 5px;
}
/* Легаси-базис вкладок. Пилюли-подвкладки редизайна используют общий
   компонент `.rd-tabs` (css/redesign-components.css, Фаза 15.1) поверх этого
   класса; голый `.tabs` остаётся для #profileTabs (подчёркнутый top-nav) и
   как база под .rd-tabs. Новые наборы подвкладок вешай `class="tabs rd-tabs"`. */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  border-bottom: none;
  flex-wrap: wrap;
  background: var(--surface-2);
  padding: 6px;
  border-radius: 12px;
}
.tabs button {
  background: none;
  border: none;
  color: #aaa;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 1em;
  transition: background 0.2s, color 0.2s;
  border-radius: 8px;
  white-space: nowrap;
  font-weight: 500;
}
.tabs button:hover {
  background: var(--surface-2);
  color: #fff;
}
.tabs button.active {
  background: var(--border-color);
  color: #fff;
  box-shadow: none;
}
@media (max-width: 600px) {
  .tabs button {
    flex: 1;
    text-align: center;
    padding: 10px 12px;
    font-size: 0.9em;
  }
}
.admin-table th, .admin-table td {
  padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--border-color); font-size: 0.9em;
}
.admin-table th { background: var(--surface-2); color: var(--text-color); }
.admin-table td input, .admin-table td select, .admin-table td textarea {
  background: var(--bg-color); border: 1px solid var(--border-color); color: white; padding: 5px;
  border-radius: 6px; font-size: 0.9em; width: 100%; max-width: 150px;
}
.admin-section {
  background: var(--surface-2); border-radius: 16px; padding: 20px; margin-bottom: 20px;
}
.admin-section h3 { color: var(--text-color); margin-bottom: 15px; }
.copy-btn {
  background: #00b894; border: none; color: white; padding: 3px 10px;
  border-radius: 10px; font-size: 0.75em; cursor: pointer; margin-left: 5px;
}
.copy-btn:hover { background: #00d2a0; }
/* top ниже высоты sticky-шапки (~74px): при top:20px тост ложился ровно на
   поле поиска в шапке и перекрывал единственный интерактивный элемент в этой
   зоне. Мобильная ветка ниже и так уводит тост вниз экрана. */
.toast {
  position: fixed; top: 88px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: var(--rd-panel-header, #13152b); color: var(--rd-text, white); padding: 12px 30px;
  border-radius: 10px; font-weight: 600;
  transition: opacity 0.4s ease, transform 0.4s ease;
  opacity: 0; pointer-events: none;
  z-index: 10000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
/* .rd-snake (css/redesign-motion.css) задаёт position:relative — тост
   должен остаться position:fixed. #toast.rd-snake (0,1,1,0) специфичнее
   голого .rd-snake (0,0,1,0), поэтому побеждает независимо от порядка
   подключения файлов. */
#toast.rd-snake { position: fixed; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* На мобильном тост снизу экрана (легче достать глазами рядом с большим
   пальцем, не перекрывает шапку/поиск) — на десктопе остаётся сверху. */
@media (max-width: 600px) {
  .toast {
    top: auto;
    left: 16px;
    right: 16px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    box-sizing: border-box;
    padding: 12px 16px;
    text-align: center;
    transform: translateY(20px);
  }
  .toast.show { transform: translateY(0); }
}
.user-card-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--surface-1); padding: 30px; border-radius: 12px;
  z-index: 200; width: 90%; max-width: 600px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5); border: 1px solid var(--border-color);
  max-height: 80vh; overflow-y: auto; display: none;
}
.user-card-modal.active { display: block; }
.user-card-modal h2 { color: var(--text-color); margin-bottom: 20px; }
.user-card-tabs { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.user-card-tabs button {
  background: none; border: none; color: #ccc; padding: 8px 16px;
  cursor: pointer; font-size: 0.95em; border-bottom: 2px solid transparent;
}
.user-card-tabs button.active { color: var(--text-color); border-bottom-color: var(--primary-color); }
.bonus-history { margin-top: 10px; }
.bonus-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-color);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 6px;
}
.bonus-item .date { font-size: 0.85em; color: #aaa; }
.bonus-item .amount { font-weight: bold; }
.bonus-item .amount.positive { color: #00b894; }
.bonus-item .amount.negative { color: var(--primary-color); }
.bonus-item .amount.clear { color: #f39c12; }
.status-select-group {
  display: flex; gap: 5px; flex-wrap: wrap;
}
.status-select-btn {
  padding: 4px 12px; border-radius: 15px; font-size: 0.85em;
  background: var(--border-color); color: #ccc; cursor: pointer; border: none;
  transition: background 0.2s;
}
.status-select-btn.active { background: var(--primary-color); color: white; }
.status-dropdown {
  position: relative;
  display: inline-flex;
  min-width: 142px;
}
.status-current {
  position: relative;
  width: 100%;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 24px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 0.86em;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.status-current:hover {
  filter: brightness(1.08);
}
.status-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.78);
  font-size: 0.82em;
}
.status-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: max-content;
  min-width: 180px;
  display: none;
  padding: 6px;
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(0,0,0,0.35);
}
.status-dropdown.open .status-menu {
  display: grid;
  gap: 2px;
}
.status-menu-item {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: 10px 1fr 16px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d8dcff;
  cursor: pointer;
  text-align: left;
  font-size: 0.86em;
}
.status-menu-item:hover,
.status-menu-item.active {
  background: #1d2248;
  color: #fff;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.status-check {
  color: #f8d94a;
  font-weight: 700;
  text-align: right;
}
.status-new { background: #3454d1; }
.status-awaiting-payment { background: #b7791f; }
.status-in-work { background: #1677c7; }
.status-completed { background: #168a5b; }
.status-error { background: var(--rd-status-error); }
.status-cancelled { background: #4c556f; }
.status-dot.status-new { background: #6f86ff; }
.status-dot.status-awaiting-payment { background: #f0b84a; }
.status-dot.status-in-work { background: #55b7ff; }
.status-dot.status-completed { background: #3fd190; }
.status-dot.status-error { background: #ff5c78; }
.status-dot.status-cancelled { background: #8a93aa; }
.filter-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; align-items: center;
}
.filter-row input, .filter-row select {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border-color);
  background: var(--bg-color); color: white; font-size: 0.9em;
}
.suggestions {
  position: absolute; background: var(--surface-1); border: 1px solid var(--border-color);
  border-radius: 8px; max-height: 150px; overflow-y: auto; width: 200px; z-index: 10000;
}
.suggestion-item { padding: 8px 12px; cursor: pointer; color: #ccc; }
.suggestion-item:hover { background: var(--border-color); }
.mass-delete-btn { display: none; }

.product-detail {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  align-items: center;
  gap: 34px;
  margin-top: 8px;
  margin-bottom: 26px;
  padding: 24px;
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: 14px;
}
.product-detail-image {
  min-width: 0;
}
.product-detail-info {
  min-width: 0;
}
.product-buy-panel {
  max-width: 680px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.product-detail-title {
  color: var(--text-color);
  margin-bottom: 16px;
  line-height: 1.18;
}
.product-buy-panel .form-group {
  margin-bottom: 18px;
}
.product-buy-panel .form-group label {
  color: var(--text-color);
  font-weight: 600;
}
.product-buy-panel .form-group select {
  min-height: 44px;
  border-color: var(--border-color-strong);
  background: var(--bg-color);
}
.product-price-large {
  margin: 4px 0 12px;
  font-size: 2.1em;
  color: var(--primary-color);
  font-weight: bold;
  line-height: 1;
}
.product-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 100%;
  margin-left: 0;
}
.product-info-section:nth-child(3) {
  grid-column: 1 / -1;
}
.product-info-section {
  padding: 20px;
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}
.product-info-section h3 {
  margin-bottom: 10px;
  color: var(--text-color);
  font-size: 1.05em;
  line-height: 1.25;
}
.product-info-content {
  max-width: 760px;
  color: var(--text-color);
  line-height: 1.55;
}
.product-info-content p {
  margin: 0 0 10px;
}
.product-info-content p:last-child {
  margin-bottom: 0;
}
/* Без явного padding маркеры и номера списка вылезают за левый край карточки:
   ol/ul в блоках заполняет админ через Quill, а глобальный сброс списков
   обнуляет отступ, на который браузер их обычно и вешает. */
.product-info-content ul,
.product-info-content ol {
  margin: 0 0 10px;
  padding-left: 1.5em;
}
.product-info-content ul:last-child,
.product-info-content ol:last-child {
  margin-bottom: 0;
}
.product-info-content li {
  margin-bottom: 6px;
}
.product-info-content li:last-child {
  margin-bottom: 0;
}
.product-info-content h4 {
  margin: 12px 0 4px;
  color: var(--text-color);
  font-size: 0.98em;
}
.product-info-content h4:first-child {
  margin-top: 0;
}
.product-info-content strong {
  color: var(--text-color);
}

.static-page-content,
.not-found-page {
  max-width: 860px;
  margin: 24px auto;
  padding: 24px;
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}
.static-page-content h1,
.not-found-page h1 {
  color: var(--text-color);
  margin-bottom: 14px;
  line-height: 1.2;
}
.static-page-content {
  color: var(--text-color);
  line-height: 1.6;
}
.static-page-content p,
.static-page-content ul,
.static-page-content ol {
  margin-bottom: 12px;
}
.not-found-page {
  text-align: center;
}
.not-found-page p {
  margin-bottom: 18px;
  color: var(--text-color);
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  z-index: 150;
}
.overlay.active { display: block; }
.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface-1);
  padding: 30px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 200;
  max-width: 400px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal.active { display: block; }

/* ===== АДАПТИВ ДЛЯ ОБЩИХ ЭЛЕМЕНТОВ (СЕТКА, КАРТОЧКИ, ТАБЛИЦЫ) ===== */
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .cart-item { flex-direction: column; align-items: flex-start; }
  .admin-table { font-size: 0.8em; }
}
@media (max-width: 400px) { .grid { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .product-detail {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }
  .product-buy-panel {
    max-width: none;
  }
  .product-info-grid {
    grid-template-columns: 1fr;
  }
  .product-info-section:nth-child(3) {
    grid-column: auto;
  }
}
@media (max-width: 600px) {
  .product-detail {
    margin-bottom: 18px;
  }
  .product-price-large {
    font-size: 1.8em;
  }
  .product-info-section {
    padding: 16px;
  }
}

/* ===== ЭКРАН ЗАГРУЗКИ ПРИ ВОССТАНОВЛЕНИИ СТРАНИЦЫ =====
   Устанавливается синхронно inline-скриптом в <head> ДО первой отрисовки —
   класс "restoring" на <html> появляется мгновенно, если сохранённая
   страница отличается от главной, и скрывает её до того, как main.js
   определит и покажет нужную страницу. Без этого была бы видна вспышка
   главной страницы перед переключением. */
#appLoadingScreen {
  display: none;
}
html.restoring #homePage {
  display: none !important;
}
html.restoring #appLoadingScreen {
  display: flex;
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  z-index: 9999;
  /* БЕЗ анимации появления. Здесь был fade-in 0.2s (Фаза 16.4, "чисто
     визуальная плавность"), и он сводил на нет весь смысл оверлея: экран
     загрузки существует ровно для того, чтобы на первой отрисовке не было
     видно недособранную страницу, а прозрачный первые 200 мс оверлей её как
     раз показывал. В трейсе с прода (3G + 10x CPU) это видно покадрово: на
     4712 мс сквозь оверлей читаются шапка без лого и подвал с дефолтами из
     разметки, к 5061 мс оверлей наконец непрозрачен. Ровно это и выглядело
     как "мигнула чужая страница" перед загрузкой. Исчезновение по-прежнему
     плавное — там скрывать уже нечего. */
}
/* Навешивается из main.js вместо мгновенного .remove() — даёт оверлею
   уйти плавно перед тем, как его реально удалят из DOM. */
#appLoadingScreen.rd-loading-screen-out {
  animation: rd-loading-screen-out 0.2s ease forwards;
}
@keyframes rd-loading-screen-out {
  to { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #appLoadingScreen.rd-loading-screen-out {
    animation: none;
  }
}
.app-loading-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    oklch(0.78 0.1 85 / 0.08),
    oklch(0.78 0.1 85 / 0.22) 48%,
    var(--rd-gold, var(--primary-color)) 86%,
    oklch(0.9 0.08 85) 100%
  );
  /* Маска оставляет геометрически ровное тонкое кольцо. В отличие от
     border-top оно не превращается во время вращения в отдельную «скобу». */
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation: app-loading-spin 0.95s linear infinite;
}
@keyframes app-loading-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .app-loading-spinner {
    animation: none;
  }
}
/* Раскрытие страницы под оверлеем (Фаза 16.4) — лёгкий fade+scale в
   момент, когда экран загрузки уходит, вместо мгновенного появления
   контента "щелчком". Класс навешивается и снимается из main.js.
   Каскад сверху вниз: шапка (0с) → тело (задержка 0.08с) → подвал
   (задержка 0.16с) — animation-delay + fill-mode "backwards" держит
   элемент невидимым всё время задержки, чтобы не было щелчка перед
   стартом собственной анимации. */
.rd-header-reveal {
  animation: rd-fade-in 0.25s ease backwards;
}
/* .page.active.rd-page-reveal (не просто .rd-page-reveal) — нужна более
   высокая специфичность, чем у базового ".page.active { animation: pageEnter
   ... }" (base.css:36-39, отдельная анимация обычного переключения страниц),
   иначе на первой загрузке побеждает pageEnter и задержка/каскад ломаются. */
.page.active.rd-page-reveal {
  animation: rd-page-reveal 0.3s ease 0.08s backwards;
}
.rd-footer-reveal {
  animation: rd-fade-in 0.25s ease 0.16s backwards;
}
@keyframes rd-fade-in {
  from { opacity: 0; }
}
@keyframes rd-page-reveal {
  from { opacity: 0; transform: scale(0.985); }
}
@media (prefers-reduced-motion: reduce) {
  .rd-header-reveal,
  .page.active.rd-page-reveal,
  .rd-footer-reveal {
    animation: none;
  }
}

/* Переключатель языка — общий для кабинета, шапки рабочего места и экрана
   обязательной настройки 2FA (js/shared/languageFlag.js). Стили тут, в
   глобальном base.css, а не в трёх scope-файлах: три копии одного контрола
   разъезжаются, а один из его домов — экран входа, где админских стилей нет. */
.rd-lang-switcher {
  display: inline-flex;
  gap: 4px;
  background: var(--rd-panel);
  border: 1px solid var(--rd-border);
  border-radius: 10px;
  padding: 3px;
}
.rd-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--rd-text-muted);
  font-family: inherit;
  font-size: var(--rd-text-sm, 0.8125rem);
  font-weight: 700;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
}
.rd-lang-btn.active {
  background: var(--rd-gold);
  color: var(--rd-on-gold);
}
/* Флагу нужна своя рамка: белая полоса российского флага сливается со светлым
   фоном активной кнопки, а синее поле британского — с тёмной панелью. */
.rd-lang-flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35);
  flex: 0 0 auto;
}
