/* ============================================================
   PREMIUM LAYER — слой дизайнерской полировки поверх style.css
   Подключается ПОСЛЕ style.css, ничего не ломает в логике,
   только усиливает визуальное впечатление ("дорогой сайт").
   Все эффекты учитывают prefers-reduced-motion.
   ============================================================ */

:root {
  --premium-ease: cubic-bezier(0.22, 1, 0.36, 1);   /* фирменная "дорогая" упругая кривая */
  --premium-ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --glow-accent: 0 0 0 1px rgba(52,211,153,0.12), 0 8px 32px -8px rgba(52,211,153,0.25);
}

/* --- 1. Фоновая атмосфера: два мягких световых пятна + тонкая сетка --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -5%, rgba(52,211,153,0.06), transparent 60%),
    radial-gradient(800px 600px at 100% 0%, rgba(56,189,248,0.045), transparent 55%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    linear-gradient(rgba(255,255,255,0.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.014) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 75%);
          mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 75%);
}

/* --- 2. Премиальные карточки: тонкая верхняя световая кромка + reveal при наведении --- */
.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.022), transparent 120px),
    var(--card);
  transition: transform 0.4s var(--premium-ease), border-color 0.3s, box-shadow 0.4s var(--premium-ease);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.14) 25%, rgba(52,211,153,0.4) 50%, rgba(255,255,255,0.14) 75%, transparent);
  opacity: 0;
  transition: opacity 0.45s var(--premium-ease);
}
.card:hover::before { opacity: 1; }

/* --- 3. Stat-карточки: курсор-следящая подсветка (премиальный "spotlight") --- */
.stat {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(52,211,153,0.10), transparent 40%),
    linear-gradient(160deg, var(--card), #11161e);
}
.stat .stat-value,
.stat .stat-label,
.stat .currency-row,
.stat .currency-rub,
.stat .balance-note { position: relative; z-index: 1; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--glow-accent); }

/* Денежные значения — благородный градиентный блеск */
.stat-value.currency-usd,
.currency-usd,
.stat-block-value,
.ticker-value {
  background: linear-gradient(92deg, #6ee7b7, #34d399 45%, #10b981);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- 4. Кнопки: блик-проводка при наведении + упругость --- */
button, .btn {
  position: relative;
  overflow: hidden;
  transition: background 0.2s, transform 0.25s var(--premium-ease), box-shadow 0.3s;
}
button:not(.btn-secondary):not(.btn-warn):hover,
.btn:not(.btn-secondary):not(.btn-warn):hover {
  box-shadow: 0 6px 20px -6px rgba(52,211,153,0.5);
  transform: translateY(-1px);
}
button::after, .btn::after {
  content: "";
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.28), transparent);
  transform: skewX(-18deg);
  transition: left 0.6s var(--premium-ease);
  pointer-events: none;
}
button:hover::after, .btn:hover::after { left: 140%; }

/* --- 5. Премиальные поля ввода: мягкое свечение фокуса --- */
input:focus, textarea:focus, select:focus {
  box-shadow: 0 0 0 3px rgba(52,211,153,0.16), 0 4px 18px -6px rgba(52,211,153,0.3);
}

/* --- 6. Топбар: настоящее "матовое стекло" --- */
.topbar {
  background: rgba(17,22,29,0.72);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
          backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Иконки в шапке — компактные круглые значки без подписи на десктопе (TASK-8 п.2,
   размер/форма заданы в style.css) — здесь только добавляем упругий hover поверх. */
.nav-icon:hover { background: rgba(255,255,255,0.05); transform: translateY(-1px); }
.nav-icon svg { display: block; flex-shrink: 0; }
.nav { gap: 4px; row-gap: 6px; }
.nav .badge { height: 22px; display: inline-flex; align-items: center; font-size: 11px; padding: 0 9px; }
.nav .user-name { font-size: 13px; }
.nav form button, .nav > a:not(.nav-icon) { font-size: 13px; }

/* Запас на случай нехватки места (узкий десктоп) — переносится на 2-ю строку, а не сжимается. */
.topbar-inner {
  flex-wrap: wrap;
  row-gap: 8px;
}
.nav {
  flex-wrap: wrap;
  row-gap: 8px;
}
/* Подпись (data-label) на десктопе скрыта (TASK-8 п.2) — значки компактные, без текста,
   с title-подсказкой при наведении. Видна только в мобильном меню-гамбургере. */

/* --- 7. Бейджи / теги: лёгкое стекло --- */
.badge, .category-tag, .goal-bonus, .shift-open-tag, .ticker-change {
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
}
.badge-director {
  background: linear-gradient(135deg, rgba(216,180,74,0.22), rgba(216,180,74,0.08));
  box-shadow: inset 0 0 0 1px rgba(216,180,74,0.3), 0 2px 12px -4px rgba(216,180,74,0.4);
}

/* --- 8. Списки: плавная подсветка строки --- */
.list-item { transition: background 0.25s var(--premium-ease), padding-left 0.25s var(--premium-ease); border-radius: 10px; }
.list-item-link:hover { padding-left: 12px; }

/* --- 9. Появление контента при загрузке (мягкий каскад) --- */
@keyframes premium-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.container > .card,
.container > .section-row,
.container > h1,
.container > .chart-wrap {
  animation: premium-rise 0.6s var(--premium-ease) both;
}
.container > h1 { animation-delay: 0.02s; }
.container > .section-row { animation-delay: 0.08s; }
.container > .card:nth-of-type(1) { animation-delay: 0.12s; }
.container > .card:nth-of-type(2) { animation-delay: 0.18s; }
.container > .card:nth-of-type(3) { animation-delay: 0.24s; }
.container > .card:nth-of-type(4) { animation-delay: 0.30s; }
.container > .card:nth-of-type(n+5) { animation-delay: 0.34s; }

/* --- 10. Заголовок H1 — деликатный световой акцент --- */
h1 {
  background: linear-gradient(180deg, #ffffff, #c6d0dc);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- 11. Скроллбар под стиль студии --- */
* {
  scrollbar-width: thin;
  scrollbar-color: #2a3543 transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #2a3543, #1d2530);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: #34d399; background-clip: padding-box; }

/* --- 12. Период-табы и pill-кнопки: упругий active --- */
.period-btn { transition: background 0.2s, color 0.2s, transform 0.2s var(--premium-ease); }
.period-btn.active { box-shadow: 0 4px 16px -4px rgba(52,211,153,0.55); }

/* --- Уважение к настройкам доступности: всё гасим --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .container > .card,
  .container > .section-row,
  .container > h1,
  .container > .chart-wrap { animation: none; opacity: 1; transform: none; }
  .auth-aurora { display: none; }
}

/* ============================================================
   PREMIUM AUTH — вау-экран входа / регистрации
   ============================================================ */
.auth-aurora {
  position: fixed;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  pointer-events: none;
}
.auth-aurora span {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}
.auth-aurora span:nth-child(1) {
  width: 46vw; height: 46vw; left: -8vw; top: -10vw;
  background: radial-gradient(circle, rgba(52,211,153,0.5), transparent 70%);
  animation: aurora-a 18s var(--premium-ease-soft) infinite alternate;
}
.auth-aurora span:nth-child(2) {
  width: 40vw; height: 40vw; right: -6vw; top: 6vw;
  background: radial-gradient(circle, rgba(56,189,248,0.42), transparent 70%);
  animation: aurora-b 22s var(--premium-ease-soft) infinite alternate;
}
.auth-aurora span:nth-child(3) {
  width: 38vw; height: 38vw; left: 30vw; bottom: -16vw;
  background: radial-gradient(circle, rgba(216,180,74,0.28), transparent 70%);
  animation: aurora-c 26s var(--premium-ease-soft) infinite alternate;
}
@keyframes aurora-a { to { transform: translate(8vw, 6vw) scale(1.15); } }
@keyframes aurora-b { to { transform: translate(-7vw, 8vw) scale(1.1); } }
@keyframes aurora-c { to { transform: translate(4vw, -8vw) scale(1.2); } }

.auth-wrap { position: relative; z-index: 1; }
.auth-wrap .auth-logo {
  animation: auth-logo-in 1s var(--premium-ease) both;
  filter: drop-shadow(0 8px 28px rgba(52,211,153,0.4));
}
@keyframes auth-logo-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.8); filter: drop-shadow(0 0 0 rgba(52,211,153,0)); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-wrap h1 { animation: premium-rise 0.7s var(--premium-ease) 0.15s both; }
.auth-wrap > .subtitle { animation: premium-rise 0.7s var(--premium-ease) 0.25s both; }
.auth-wrap .card {
  animation: premium-rise 0.8s var(--premium-ease) 0.35s both;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 140px),
    rgba(21,27,36,0.78);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
          backdrop-filter: blur(20px) saturate(150%);
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 24px 70px -20px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.05);
}
.auth-wrap > .subtitle:last-child { animation: premium-rise 0.7s var(--premium-ease) 0.5s both; }

/* --- Чат: имена отправителей — белым текстом на чёрном фоне (по просьбе директора) --- */
.chat-msg-author {
  display: inline-block;
  background: #000;
  color: #fff !important;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}

/* ============================================================
   МОБИЛЬНАЯ ВЁРСТКА — ничего не должно вылезать за границы экрана.
   ============================================================ */

/* Глобальная страховка: ни один элемент не должен быть шире вьюпорта */
html, body { max-width: 100vw; overflow-x: hidden; }
img, svg, video, canvas, iframe { max-width: 100%; }
* { min-width: 0; } /* частая причина переполнения flex/grid-контейнеров — убираем дефолтный min-width:auto */

/* Безопасный скролл-контейнер для широких таблиц (калькулятор, площадки) —
   скроллится САМ внутри себя, не раздвигая страницу. */
.table-scroll-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 760px) {
  /* Отключаем старую раскладку таблицы "в столбик" — она и была причиной переполнения
     (display:block на <table> ломает выравнивание ячеек). Превращаем строки в компактные карточки. */
  .token-table { display: table; width: 100%; min-width: 0; white-space: normal; }
  .table-scroll-wrap .token-table { min-width: 0; }

  .token-table thead { display: none; }
  .token-table, .token-table tbody, .token-table tr, .token-table td { display: block; width: 100%; }
  .token-table tr {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
  }
  .token-table td {
    padding: 4px 0;
    border: none;
    white-space: normal;
    word-break: break-word;
  }
  .token-table input, .token-table select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .token-table .token-usd { font-weight: 700; }
}

/* ============================================================
   СТРАНИЦА ЗАРПЛАТ — недельный навигатор + общая полировка
   ============================================================ */
.salary-week-nav { padding: 18px 20px; }
.salary-week-nav-row { display: flex; align-items: center; justify-content: center; gap: 18px; }
.salary-week-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 12px; border: 1px solid var(--line);
  font-size: 22px; line-height: 1; color: var(--ink);
  text-decoration: none; background: var(--paper);
  transition: background 0.2s, transform 0.2s var(--premium-ease), border-color 0.2s;
}
.salary-week-arrow:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.salary-week-arrow.is-disabled { opacity: 0.3; pointer-events: none; }
.salary-week-current { display: flex; align-items: center; gap: 12px; text-align: center; }
.salary-week-icon { color: var(--accent); flex-shrink: 0; }
.salary-week-label { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.salary-week-select { margin: 0 auto; font-size: 12px; color: var(--ink-soft); background: transparent; border: none; padding: 0; cursor: pointer; }

/* Больше воздуха и аккуратнее кнопки везде на странице зарплат */
#salaryWeekTable, .salary-page .card { padding: 22px; }
.salary-page .card + .card { margin-top: 18px; }
.salary-page table.token-table th, .salary-page table th { padding: 12px 14px; }
.salary-page table td { padding: 14px; vertical-align: top; }
.salary-page .pay-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.salary-page .btn-small, .salary-page .btn-secondary.btn-small {
  padding: 7px 14px; border-radius: 9px; font-size: 12.5px;
}
.salary-page details > summary.btn-secondary { padding: 7px 14px; border-radius: 9px; }
.salary-page .list-item, .salary-page .pay-status { padding-top: 4px; padding-bottom: 4px; }

@media (max-width: 760px) {
  .salary-week-nav-row { gap: 10px; }
  .salary-week-label { font-size: 16px; }
  .salary-week-icon svg { width: 16px; height: 16px; }
}
