/* =============================================================================
   app.css — Структурированная версия
   ВНИМАНИЕ: Поведение и каскад не изменены. Я добавил только секционные
   заголовки, выровнял стиль комментариев и пометил потенциальные коллизии.

   СОДЕРЖАНИЕ:
     1) База и темы (CSS variables)
     2) Базовые стили и типографика
     3) Лэйаут (header, nav, container, footer)
     4) Компоненты: карточки, кнопки, формы, alert, таблицы, чипсы, бэйджи
     5) Утилиты (grid/flex/spacing/visibility)
     6) Специальные блоки (Фонд/ЗП KPI, Players/Games/Loc inline)
     7) Формы: разделы, свитч, checklist
     8) Topbar/NAV (доп. навигация)
     9) Темы оформления: Squid Game
    10) Дублирующиеся селекторы/усиления (примечания)

   ПРИМЕЧАНИЯ:
   - В коде встречаются переменные, не определённые в :root: --panel-strong,
     --success-700, --error-700, --primary-10, --primary-20. Они определены в
     теме "squid" либо не заданы по умолчанию. Я НЕ добавлял дефолты, чтобы
     не менять поведение. Пометил комментариями места использования.
   - Селекторы .table, .grid, .btn и др. встречаются несколько раз для уточнений.
     Порядок оставлен исходным, чтобы каскад сохранился.
============================================================================= */

/* ============================== 1) БАЗА / ТЕМЫ ============================ */
:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --border: #e6e8ef;
  --text: #0f172a;
  --muted: #64748b;
  --text-muted: var(--muted);

  /* Фирменные цвета сняты с логотипа клуба (assets/logos/logo.png):
     #00E1FF — неоновое свечение и глаза енота
     #008DC9 — надпись «МАФИЯ БАЛАГАН ТВЕРЬ»
     #F4CC00 — лента DO NOT CROSS */
  --primary: #007db4;
  --primary-500: #007db4;
  --primary-600: #006d9e;
  --primary-100: #d9f4ff;
  --primary-700: #005a83;
  --neon: #00e1ff;
  --tape: #f4cc00;
  --on-primary: #ffffff;   /* светлая тема: primary тёмный, текст белый */
  /* Второй акцент. Раньше --accent жил только в теме squid,
     поэтому кнопка .btn-accent в обычных темах оставалась без цвета. */
  --accent: #008479;
  --accent-100: #d2fbf6;
  --accent-700: #00806f;
  --on-accent: #ffffff;
  --primary-20: color-mix(in oklab, var(--primary), transparent 80%);
  --primary-10: color-mix(in oklab, var(--primary), transparent 90%);

  --error: #ef4444;
  --error-100: #fee2e2;
  --error-700: #b91c1c;

  --warn: #f59e0b;
  --warn-100: #fef3c7;

  --success: #16a34a;
  --success-100: #dcfce7;
  --success-700: #15803d;

  --panel-strong: color-mix(in oklab, var(--panel) 85%, white 15%);
  --panel-weak: color-mix(in oklab, var(--panel) 92%, transparent);
  --shadow: 0 6px 20px rgba(2, 6, 23, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --space-lg: 24px;
  --space-xl: 32px;

  --focus: 0 0 0 3px rgba(37, 99, 235, .35);

  --success-700: #15803d;
  --error-700: #b91c1c;
  --primary-10: rgba(37,99,235,.08);
  --primary-20: rgba(37,99,235,.16);
}

html[data-theme="dark"] {
  /* Тёмная тема ближе к логотипу: неон на почти-чёрном, а не сине-серый */
  --bg: #07090d;
  --panel: #0e1319;
  --border: #1b232d;
  --text: #e8eef4;
  --muted: #8b98a8;

  --primary: #00e1ff;
  --primary-500: #00e1ff;
  --primary-600: #00b8d4;
  --primary-100: #06222b;
  --primary-700: #22e8ff;
  --neon: #00e1ff;
  --tape: #f4cc00;
  --on-primary: #04141a;   /* тёмная тема: primary яркий неон, текст тёмный */
  --accent: #00d1c1;
  --accent-100: #06231f;
  --accent-700: #22e8d8;
  --on-accent: #04141a;

  --error: #f87171;
  --error-100: #2a1214;

  --warn: #fbbf24;
  --warn-100: #2b2410;

  --success: #34d399;
  --success-100: #10241d;

  --panel-weak: color-mix(in oklab, var(--panel) 80%, transparent);
  --shadow: 0 8px 24px rgba(0,0,0,.35);
}

/* ====================== 2) БАЗА СТИЛЕЙ / ТИПОГРАФИКА ===================== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 800px at 10% -20%, rgba(37,99,235,.06), transparent 50%),
              radial-gradient(900px 600px at 110% -10%, rgba(34,197,94,.06), transparent 40%),
              var(--bg);
}

body.modal-open {
  overflow: hidden;
  height: 100%;
}

body.page-fade { opacity: 0; }
body.page-fade.page-ready { animation: pageFadeIn .35s ease-out forwards; }

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Типографика */
h1, h2, h3 { margin: 0 0 12px 0; font-weight: 700; letter-spacing: .2px; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; color: var(--text); }

.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.opacity-70 { opacity: .7; }
.opacity-60 { opacity: .6; }
.muted { color: var(--muted); }

/* =============================== 3) ЛЕЙАУТ =============================== */
.container { max-width: 1120px; margin-inline: auto; padding-inline: 16px; }
.brand-link { text-decoration: none; color: var(--text); font-weight: 700; letter-spacing: .2px; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px;
  color: var(--muted); text-decoration: none; transition: .15s ease;
}
.nav-link:hover { background: var(--panel); box-shadow: var(--shadow); color: var(--text); }
.nav-link.active { background: var(--primary-100); color: var(--primary); }

.main { padding-block: 22px; }

/* ===================== 3b) TOOLBARS / HELPERS ===================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 0;
}
.toolbar-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 32px;
}
.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-actions { justify-content: flex-start; }
}

.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-3 { grid-template-columns: 1fr; } }

.empty-state {
  padding: 32px 24px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--panel) 70%, transparent);
  color: var(--muted);
}
.empty-state .empty-title { font-size: 18px; font-weight: 700; color: var(--text); }
.empty-state .empty-desc { margin-top: 4px; font-size: 13px; }

.danger { color: var(--error-700); font-weight: 600; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--panel) 85%, transparent);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}
.status.ok {
  background: var(--success-100);
  border-color: color-mix(in oklab, var(--success), var(--border) 60%);
  color: var(--success-700);
}
.status.bad {
  background: var(--error-100);
  border-color: color-mix(in oklab, var(--error), var(--border) 60%);
  color: var(--error-700);
}

/* ============================== 4) КОМПОНЕНТЫ =========================== */
/* Карточки */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .22s ease, border-color .18s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}
.card-hover {
  position: relative;
  transition: transform .18s ease, box-shadow .22s ease;
}
.card-hover:hover {
  transform: translateY(-3px) scale(1.005);
  box-shadow: var(--shadow-lg, 0 18px 45px rgba(0,0,0,.18));
}
.card-hover.shadow-left { box-shadow: -14px 18px 40px rgba(15,23,42,.18); }
.card-hover.shadow-right { box-shadow: 14px 18px 40px rgba(15,23,42,.18); }
.card-hover.shadow-center { box-shadow: 0 22px 46px rgba(15,23,42,.2); }

.shadow-lg { box-shadow: 0 18px 45px rgba(0,0,0,.18); }

.z-1 { box-shadow: 0 10px 24px rgba(15,23,42,.10); }
.z-2 { box-shadow: 0 14px 32px rgba(15,23,42,.13); }
.z-3 { box-shadow: 0 18px 40px rgba(15,23,42,.18); }

.card-cluster {
  position: relative;
}
.card-cluster:hover .card:not(:hover) {
  transform: scale(.995);
  opacity: .92;
}
.card-body { padding: var(--space-lg, 24px); }

/* Универсальная панель секции (контейнер для форм, таблиц, блоков) */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Вариант панели без тени (когда нужно более плоско) */
.panel--flat {
  box-shadow: none;
  border: 1px solid var(--border);
}

/* Заголовок секции внутри панели */
.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  font-size: 18px;
  font-weight: 600;
}

.panel-subtitle {
  font-size: 13px;
  color: var(--muted);
}

/* Сетка панелей / карточек на дашбордах */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px;
  align-items: stretch;
}

/* Более плотная сетка для маленьких блоков */
.panel-grid--dense {
  gap: 20px;
}

.card-grid {
  display: grid;
  gap: var(--space-lg, 24px);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.card-grid.two-up { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card-grid.three-up { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }


.btn-uniform {
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
}

/* Кнопки */
.btn {
  --btn-bg: var(--panel);
  --btn-fg: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid color-mix(in oklab, var(--border), #000 5%);
  border-radius: 12px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  cursor: pointer; text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease,
    border-color .16s ease, color .16s ease, filter .16s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); filter: brightness(.98); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.disabled,
.btn:disabled,
.btn[disabled],
.btn.is-loading {
  opacity: .55;
  pointer-events: none;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(.2);
}

.btn-sm { height: 30px; padding: 0 10px; border-radius: 10px; }
.btn-xs { height: 26px; padding: 0 8px;  border-radius: 9px; }
.btn-sm:hover { transform: translateY(-1px); }

.btn-secondary {
  --btn-bg: color-mix(in oklab, var(--primary), #fff 85%);
  --btn-fg: color-mix(in oklab, var(--primary), #000 30%);
  border-color: color-mix(in oklab, var(--primary-20), var(--border));
}
.btn-secondary:hover {
  --btn-bg: color-mix(in oklab, var(--primary), #fff 75%);
  border-color: color-mix(in oklab, var(--primary-20), var(--primary));
}

/* Текст на кнопке подбирается под яркость фона: на фирменном циане
   белый нечитаем, нужен тёмный. contrast-color пока поддержан не везде,
   поэтому цвет задаём переменной темы. */
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: color-mix(in oklab, var(--primary), #000 10%);
}
.btn-primary:hover {
  background: var(--primary-600);
  color: var(--on-primary);
  filter: none;
}
.btn-danger,
.btn-error {
  background: var(--error);
  color: #fff;
  border-color: color-mix(in oklab, var(--error), #000 10%);
}
.btn-danger:hover,
.btn-error:hover { background: color-mix(in oklab, var(--error), #000 10%); filter: none; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: color-mix(in oklab, var(--panel) 70%, transparent); color: var(--primary-600); }

.btn .btn-spinner {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid color-mix(in oklab, var(--primary), transparent 60%);
  border-top-color: var(--primary);
  animation: btn-spin .6s linear infinite;
  margin-right: 6px;
}
.btn .btn-label { display: inline-flex; align-items: center; }

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ======================= FORM COMPONENTS ======================= */
.form-section { display: flex; flex-direction: column; gap: 20px; }

.form-row,
.form-group,
.fieldset {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

label { display: inline-block; margin-bottom: 6px; color: var(--text-muted, var(--muted)); font-size: 12.5px; }
.form-label,
.label {
  font-size: 13px;
  color: var(--text-muted, var(--muted));
  letter-spacing: 0.3px;
  font-weight: 600;
}

.form-input,
.form-select,
.form-textarea,
.input,
input[type="text"],
input[type="date"],
input[type="number"],
input[type="tel"],
input[type="email"],
select,
textarea {
  width: 100%;
  min-height: 36px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color .15s ease, box-shadow .15s ease, background .2s ease;
}

.form-textarea,
textarea {
  min-height: 90px;
  resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.input:focus,
input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-20);
  background: var(--panel-strong);
}

.form-error {
  font-size: 12px;
  color: var(--error);
  margin-top: -4px;
}

.checkbox,
.radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text);
}

.checkbox input[type="checkbox"],
.radio input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid color-mix(in oklab, var(--border), #000 4%);
  background: var(--panel);
  border-radius: 6px;
  position: relative;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
  box-shadow: inset 0 -1px 1px rgba(15, 23, 42, .08);
}

.checkbox input[type="checkbox"]:focus-visible,
.radio input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-20);
}

.checkbox input[type="checkbox"]::after,
.radio input[type="radio"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.6);
  opacity: 0;
  transition: transform .15s ease, opacity .15s ease;
}

.checkbox input[type="checkbox"] {
  border-radius: 6px;
}
.checkbox input[type="checkbox"]::after {
  content: "✓";
  width: 100%;
  height: 100%;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.checkbox input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.02);
  color: #fff;
}
.checkbox input[type="checkbox"]:checked::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.radio input[type="radio"] {
  border-radius: 50%;
}
.radio input[type="radio"]::after {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
}
.radio input[type="radio"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.radio input[type="radio"]:checked::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  background: color-mix(in oklab, var(--panel) 80%, transparent); border: 1px solid var(--border); cursor: pointer; }
.chip input { accent-color: var(--primary); }

/* Alerts */
.alert { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); box-shadow: var(--shadow); }
.alert-success { background: var(--success-100); color: var(--text); border-color: color-mix(in oklab, var(--success), var(--border) 60%); }
.alert-error   { background: var(--error-100);   color: var(--text); border-color: color-mix(in oklab, var(--error), var(--border) 60%); }
.alert-warning { background: var(--warn-100);    color: var(--text); border-color: color-mix(in oklab, var(--warn), var(--border) 60%); }

/* Таблицы (версия 1) */
.table-responsive { width: 100%; overflow: visible; }

.table thead th {
  text-align: left; font-weight: 700; font-size: 12.5px; color: var(--muted);
  background: color-mix(in oklab, var(--panel) 80%, transparent);
  border-bottom: 1px solid var(--border); padding: 10px 12px; white-space: nowrap;
}
.table tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table.striped tbody tr:nth-child(odd) { background: var(--panel-weak); }
.table tbody tr {
  transition: background 150ms ease, transform 120ms ease;
}
.table tbody tr:hover {
  background: var(--primary-10);
  transform: translateX(2px);
}
.table tbody tr:last-child td { border-bottom: 0; }

.row-highlight,
.row-highlight:hover {
  background: #fff7c2 !important;
}

.row-highlight {
  animation: rowHighlight 1.3s ease-out forwards;
}

@keyframes rowHighlight {
  0% { box-shadow: inset 0 0 0 1px rgba(250, 204, 21, .4); }
  100% { box-shadow: inset 0 0 0 1px transparent; }
}

.skeleton-row {
  pointer-events: none;
}

.skeleton-row .skeleton-cell {
  position: relative;
  color: transparent;
  min-height: 18px;
}

.skeleton-row .skeleton-cell > * {
  opacity: 0;
}

.skeleton-row .skeleton-cell::after {
  content: "";
  display: block;
  width: 100%;
  height: .8em;
  border-radius: 999px;
  background: linear-gradient(100deg,
    color-mix(in oklab, var(--panel-weak), transparent 5%) 10%,
    color-mix(in oklab, var(--panel-weak), var(--primary-10)) 50%,
    color-mix(in oklab, var(--panel-weak), transparent 5%) 90%);
  animation: skeletonPulse .9s ease-in-out infinite;
}

@keyframes skeletonPulse {
  0% { opacity: .45; transform: scaleX(.96); }
  100% { opacity: 1; transform: scaleX(1); }
}

/* ========================== PRO ANIMATIONS ============================== */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-kpi {
  animation: fadeSlideUp .35s ease both;
  will-change: transform, opacity;
}

.animate-fade {
  animation: fadeIn .25s ease both;
}

.stagger-1 { animation-delay: .05s; }
.stagger-2 { animation-delay: .1s; }
.stagger-3 { animation-delay: .15s; }
.stagger-4 { animation-delay: .2s; }

.fade-out-table {
  opacity: 0;
  transition: opacity .22s ease;
}

.fade-in-table {
  opacity: 1;
  transition: opacity .22s ease;
}

@keyframes kpiPulse {
  0% { transform: scale(1); filter: none; }
  50% { transform: scale(1.04); filter: drop-shadow(0 4px 8px rgba(37,99,235,.25)); }
  100% { transform: scale(1); filter: none; }
}

.kpi-pulse {
  animation: kpiPulse .35s ease-out;
}

/* =========================== STICKY TABLES ============================= */
.sticky-table {
    overflow: visible;
}

table.sticky-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel-strong);
  z-index: 10;
}

table.sticky-table thead {
  transition: box-shadow 120ms ease;
}

.table-header-stuck thead {
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Бейджи */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; font-size: 12px; font-weight: 600; border-radius: 999px; border: 1px solid var(--border); background: color-mix(in oklab, var(--panel) 80%, transparent); }
.badge-success { background: var(--success-100); color: var(--text); border-color: color-mix(in oklab, var(--success), var(--border) 60%); }
.badge-warn    { background: var(--warn-100);    color: var(--text); border-color: color-mix(in oklab, var(--warn), var(--border) 60%); }
.badge-error   { background: var(--error-100);   color: var(--text); border-color: color-mix(in oklab, var(--error), var(--border) 60%); }

/* ================================ 5) УТИЛИТЫ ============================= */
.flex { display: flex; }

.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.inline { display: inline; }
.hidden { display: none !important; }

.text-meta { font-size: 12px; color: var(--muted); }

.actions-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.actions-buttons .btn {
  min-width: 150px;
}

/* ====================== 6) СПЕЦ. БЛОКИ (Фонд/ЗП и т.п.) ================== */
/* KPI cards */
.kpi-card {
  background: var(--panel);
  border: 1px solid color-mix(in oklab, var(--border), transparent 35%);
  border-radius: 20px;
  padding: 28px 32px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100%;
}

.kpi-card-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .02em;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 48px;
  row-gap: 14px;
  align-items: center;
}

.kpi-grid .label {
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-grid .value {
  font-size: 28px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.kpi-card .amount,
.kpi-amount {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
}

@media (max-width: 640px) {
  .kpi-card {
    padding: 24px;
  }

  .kpi-grid {
    column-gap: 24px;
  }

  .kpi-grid .value {
    font-size: 24px;
  }
}

/* суммы/денежные метки */
.amount { font-variant-numeric: tabular-nums; font-weight: 700; }
.table.prize-table th,
.table.prize-table td {
  padding: 14px 18px;
  vertical-align: middle;
}
.table.prize-table tbody tr {
  height: 52px;
}
.amount-in { color: var(--success-700); }  /* Внимание: --success-700 не задан в :root */
.amount-out { color: var(--error-700); }   /* Внимание: --error-700 не задан в :root */

/* список-«карточки» для ведущих */
.list .list-item.hoverable { transition: transform .08s ease, box-shadow .12s ease; }
.list .list-item.hoverable:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(0,0,0,.06); }
.list-row { display:flex; align-items:center; justify-content:space-between; gap: 1rem; }
.list-main { display:flex; flex-direction:column; gap:2px; }
.list-title { font-weight:700; }

/* инпут общего вида (если нет своего класса) */

.input[type="file"] { padding: 6px 10px; min-height: auto; height: auto; }

/* ================= 7) FORMS / SETTINGS / IMPORTS POLISH ================= */
.section-title h3 { margin: 0 0 2px 0; font-weight: 800; }
.section-title .text-meta { opacity: .75; }

.fieldset .hint { font-size: 12px; opacity: .7; }

/* «мягкая» карточка */
.card.soft {
  background: var(--panel-strong);
  border-color: color-mix(in oklab, var(--border), #fff 30%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.badge-row { display:flex; align-items:center; justify-content:space-between; gap:.5rem; }
.badge-row .badge { background: var(--panel); border: 1px solid var(--border); }

/* чеклист */
.checklist { margin: 0; padding-left: 18px; display: grid; gap: .35rem; }
.checklist li { line-height: 1.4; }

/* красивый свитч */
.switch { --h: 28px; position: relative; display: inline-flex; align-items: center; }
.switch input { display: none; }
.switch span { width: 54px; height: var(--h); border-radius: var(--h); background: var(--border); position: relative; transition: background .15s; display: inline-block; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(var(--h) - 4px); height: calc(var(--h) - 4px); background: white; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.1); transition: transform .15s; }
.switch input:checked + span { background: var(--success-100); }
.switch input:checked + span::after { transform: translateX(26px); }

/* ============================ 8) TOPBAR / NAV ============================ */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--panel-strong); border-bottom: 1px solid var(--border); backdrop-filter: saturate(1.2) blur(6px); } /* --panel-strong */
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }

.brand { font-weight: 800; letter-spacing: .2px; text-decoration: none; color: var(--text); padding: 6px 8px; border-radius: 10px; }

.menu ul { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.menu a {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}
.menu a:hover {
  background: color-mix(in oklab, var(--panel), transparent 30%);
  border-color: var(--border);
  color: var(--primary-600);
}
.menu a.active { background: var(--primary-10); border-color: var(--primary-20); box-shadow: inset 0 0 0 1px var(--primary-20); font-weight: 700; } /* --primary-10/20 */

.topbar-actions { display: flex; gap: 8px; }

/* Утилиты сетки */

@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Доступность */
.nav a[aria-current="page"], .menu a[aria-current="page"] { background: var(--primary-10); color: var(--text); font-weight: 700; } /* --primary-10 */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { box-shadow: var(--focus); }

/* Заголовок и секции страницы */
.page-section {
  padding: var(--space-lg, 24px);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-title { margin: 0; font-size: 20px; font-weight: 800; }

/* ===================== 9) ТЕМА: SQUID GAME (вариант) ==================== */
[data-theme="squid"] {
  --bg: #0b0f14;
  --panel: #0f1722;
  --border: #1f2a3a;
  --text: #e9eef5;
  --muted: #9fb0c3;

  /* Squid palette */
  --primary: #ff2b6b;         /* hot pink */
  --primary-100: #ffe1ec;
  --primary-700: #e0215d;
  --primary-20: color-mix(in oklab, var(--primary), transparent 80%);
  --primary-10: color-mix(in oklab, var(--primary), transparent 90%);

  --accent: #00d1c1;          /* teal-cyan */
  --accent-100: #d2fbf6;
  --accent-700: #00b0a3;
  --on-primary: #ffffff;
  --on-accent: #00130f;
  --neon: #ff2b6b;
  --tape: #f4cc00;

  --error: #ff4d4f;
  --error-100: #ffe6e6;

  --warn: #f59e0b;
  --warn-100: #fff1cf;

  --ok: #00ff85;              /* neon green */
  --ok-100: #deffe9;

  --shadow: 0 12px 30px rgba(0, 0, 0, .35);
  --focus: 0 0 0 2px color-mix(in oklab, var(--primary) 50%, white 50%);
}
[data-theme="squid"] .menu a.active,
[data-theme="squid"] .nav a.active {
  background: var(--primary-10);
  border-color: var(--primary-20);
  box-shadow: inset 0 0 0 1px var(--primary-20);
}

/* Кнопки — усиление для темы */
.btn, .btn-sm, .btn-xs { font-weight: 700; letter-spacing: .2px; }
.btn { height: 38px; padding: 0 16px; border-radius: 12px; }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 10px; }
.btn-xs { height: 28px; padding: 0 10px; border-radius: 9px; }

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }

/* Squid variants */
.btn-squid { background: var(--primary); border-color: color-mix(in oklab, var(--primary), #000 15%); color: var(--on-primary); }
.btn-squid:hover { filter: brightness(.96); }
.btn-accent { background: var(--accent); border-color: color-mix(in oklab, var(--accent), #000 15%); color: var(--on-accent); }
.btn-accent:hover { filter: brightness(.98); }

.btn-ghost { background: transparent; border-color: color-mix(in oklab, var(--panel), var(--border) 60%); }
.btn-ghost:hover { background: color-mix(in oklab, var(--panel) 70%, transparent); }

/* Group */
.btn-group { display: inline-flex; gap: 6px; }
.btn-group .btn { border-radius: 10px; }
.btn-group .btn:first-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.btn-group .btn:last-child  { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }

/* Таблицы — уточнение/усиление (версия 2) */
.table { width: 100%; border-collapse: collapse; border-spacing: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); background: color-mix(in oklab, var(--panel), #000 4%); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: color-mix(in oklab, var(--panel), var(--primary-10)); }

/* Модификаторы плотности */
.table.compact th, .table.compact td { padding: 8px 10px; }
.table.loose   th, .table.loose   td { padding: 12px 14px; }

/* Выравнивания */
.t-right { text-align: right; }
.t-center { text-align: center; }

/* Бейджи темы */
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.badge-squid { background: var(--primary-10); color: var(--primary-700); box-shadow: inset 0 0 0 1px var(--primary-20); }
.badge-accent { background: color-mix(in oklab, var(--accent) 10%, transparent); color: #0b2b28; box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 20%, transparent); }

/* Карточки — уточнение */
.card { border-radius: 16px; border: 1px solid var(--border); background: var(--panel); box-shadow: var(--shadow); }

/* Индикатор темы на кнопке */
[data-action="toggle-theme"][data-theme-indicator="squid"] { filter: saturate(1.2) drop-shadow(0 0 6px color-mix(in oklab, var(--primary), transparent 60%)); }

/* KPI: игроки */
.players-inline { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.players-inline .player-metric { flex: 1; text-align: center; position: relative; }
.players-inline .player-metric:not(:last-child)::after { content: "|"; position: absolute; right: -0.5rem; top: 50%; transform: translateY(-50%); color: var(--muted, #888); }
.players-inline .amount { font-size: 1.5rem; font-weight: 600; }

/* KPI: игры */
.games-inline { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.games-inline .game-metric { flex: 1; text-align: center; position: relative; }
.games-inline .game-metric:not(:last-child)::after { content: "|"; position: absolute; right: -0.5rem; top: 50%; transform: translateY(-50%); color: var(--muted, #888); }
.games-inline .amount { font-size: 1.5rem; font-weight: 600; }

/* KPI: по типам игр */
.loc-inline { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.loc-inline .loc-metric { flex: 1; text-align: center; position: relative; }
.loc-inline .loc-metric:not(:last-child)::after { content: "|"; position: absolute; right: -0.5rem; top: 50%; transform: translateY(-50%); color: var(--muted, #888); }
.loc-inline .amount { font-size: 1.2rem; font-weight: 600; }

/* Дополнительные утилиты (повтор — ок) */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.input { width: 100%; min-height: 36px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; }
.form-group label { display:block; margin-bottom:.25rem; font-weight:500; }
.checkbox { display:flex; align-items:center; gap:.5rem; }

/* === Analytics Filters === */
.filters-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filters-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: flex-end;
}

.filters-grid .filters-quick {
  grid-column: 1 / -1;
}

.filters-card .form-row {
  margin: 0;
}

.filters-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.quick-links {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}

.quick-links .btn {
  min-width: max-content;
}

/* === Stats Page Helpers === */
.stats-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.stats-card-header h3 {
  margin: 0;
}

/* === Fund Page === */
.fund-toolbar {
  align-items: flex-end;
}

.fund-toolbar-actions {
  display: flex;
  gap: var(--space-lg, 24px);
  flex-wrap: wrap;
}

.fund-toolbar-form {
  display: inline-flex;
}

.fund-metrics .card {
  min-height: 100%;
}

.fund-table tbody tr {
  height: 52px;
  transition: transform .15s ease, box-shadow .15s ease;
}

.fund-table tbody tr:hover {
  transform: translateX(4px);
}

/* === Payroll Page === */
.payroll-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-lg, 24px);
}

.payroll-kpi {
  padding: var(--space-lg, 24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  background: var(--panel-weak);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.payroll-kpi .amount {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .2px;
}

.payroll-table tbody tr {
  height: 56px;
  transition: transform .15s ease, box-shadow .15s ease;
}

.payroll-table tbody tr:hover {
  transform: translateX(4px);
}

.payroll-table .btn {
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
}

.payroll-months {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl, 32px);
}

.payroll-month-block {
  padding-bottom: var(--space-lg, 24px);
  border-bottom: 1px solid var(--border);
}

.payroll-month-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.payroll-month-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-lg, 24px);
}

.payroll-month-header strong {
  font-size: 15px;
}

.payroll-month-header .text-meta {
  font-size: 12px;
}

/* === Seasons Page === */
.seasons-table tbody tr {
  height: 54px;
}

.seasons-table tbody tr:hover {
  background: color-mix(in oklab, var(--primary-10, rgba(37,99,235,.08)), transparent 30%);
}

.season-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.season-actions .btn {
  min-width: max-content;
}

.season-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.season-form .form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

.season-form label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  margin: 0 0 6px;
  color: var(--text);
}

.season-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.season-form input[type="text"],
.season-form input[type="date"],
.season-form select {
  height: 44px;
  border-radius: 10px;
}

.season-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

/* === Staff Page === */
.staff-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr);
  gap: var(--space-lg, 24px);
  align-items: flex-start;
}

@media (max-width: 960px) {
  .staff-layout {
    grid-template-columns: 1fr;
  }
}

.staff-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg, 24px);
}

.staff-form .form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

.staff-form label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  color: var(--text);
}

.staff-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg, 24px);
}

.staff-form input,
.staff-form select {
  height: 44px;
  border-radius: 10px;
}

.staff-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.form-input-sm {
  height: 36px;
  padding: 0 12px;
}

.staff-table tbody tr {
  height: 58px;
  transition: background .15s ease, transform .15s ease;
}

.staff-table tbody tr:hover {
  background: color-mix(in oklab, var(--primary-10, rgba(37,99,235,.08)), transparent 20%);
  transform: translateX(2px);
}

.staff-table .col-id { width: 140px; }
.staff-table .col-name { width: 30%; }
.staff-table .col-phone { width: 180px; }
.staff-table .col-date { width: 160px; }
.staff-table .col-status { width: 140px; }
.staff-table .col-actions { width: 260px; }

.staff-row-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.staff-row-actions .btn {
  min-width: max-content;
}

/* адаптив: ужимаем фильтры на узких экранах */
@media (max-width: 900px) {
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .filters-grid {
    grid-template-columns: 1fr;
  }
}

.table-panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.table-panel > .table {
  margin: 0;
}

/* ====== Денежные и числовые колонки (финал) ====== */
.table td.t-num, .table th.t-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Специальная таблица для ЗП — фиксируем колонки, чтобы всё было строго под заголовками */
.table--payroll { table-layout: fixed; }
.table--payroll col.col-w-80  { width: 80px; }   /* Игр */
.table--payroll col.col-w-120 { width: 120px; }  /* деньги/шт */
.table--payroll col.col-auto  { width: auto; }   /* Ведущий — растягиваем */

/* Полосы для читаемости */
.table tbody tr:nth-child(odd) {
  background: color-mix(in oklab, var(--panel) 96%, transparent);
}

.table tfoot tr {
  border-top: 2px solid var(--border);
  background: color-mix(in oklab, var(--panel) 92%, transparent);
}

.table td, .table th {
  border-right: 1px solid var(--border);
}
.table td:last-child, .table th:last-child {
  border-right: none;
}

/* ================== 10) ЗАМЕТКИ О ДУБЛЯХ / ПОРЯДКЕ ===================== */
/*
 - .table объявлена несколько раз (секции 4 и 9): это намеренно усиленные
   стили для разных контекстов. Порядок не менял, чтобы сохранить каскад.
 - .grid/.grid-2 дублируются ближе к концу файла — оставлено как есть.
 - Использование var(--panel-strong), --success-700, --error-700, --primary-10/20
   — помечено комментариями. При желании можно задать дефолты в :root,
   но это приведёт к визуальным изменениям. Поэтому я не трогал.
*/


/* ===== Игры: выравнивание таблицы ===== */
.table.compact.gridlines th,
.table.compact.gridlines td {
  border-right: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}
.table.compact.gridlines th:last-child,
.table.compact.gridlines td:last-child { border-right: 0; }

/* высоты контролов внутри таблицы */
.table td input[type="text"],
.table td input[type="date"],
.table td input[type="number"] {
  height: 32px;
  padding: 4px 8px;
  font-size: 13px;
  border-radius: 8px;
}

/* маленькие кнопки в строке */
.table td .btn,
.table td .btn-sm,
.table td .btn-ghost.btn-sm {
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
}

/* узкие инпуты в колонках по месту */
.table .col-date input[type="date"] { width: 140px; }
.table .col-extra .input { width: 100px; }
.table .col-players input[type="number"] { width: 90px; }

/* сетка ширин колонок, чтобы «не прыгало» */
.table .col-check   { width: 44px;  text-align: center; }
.table .col-date    { width: 160px; }
.table .col-loc     { width: 160px; }
.table .col-status  { width: 180px; }
.table .col-host    { width: 200px; }
.table .col-players { width: 180px; }
.table .col-extra   { width: 160px; }
.table .col-actions { width: 440px; }

/* лёгкая «зебра» и подчёркнутый футер */
.table.compact tbody tr:nth-child(odd) {
  background: color-mix(in oklab, var(--panel) 96%, transparent);
}
.table tfoot tr {
  border-top: 2px solid var(--border);
  background: color-mix(in oklab, var(--panel) 92%, transparent);
}

/* подсказки под «Допка» — разрежаем и выравниваем */
.table .col-extra .text-xs { display:block; margin-top: 4px; opacity:.8; }

/* чекбокс «выделить всё» по центру */
.col-check label.chip { padding: 0; border: 0; background: transparent; }

/* === Bulk Actions (массовые действия) === */
.bulk-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.bulk-actions .bulk-title {
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.bulk-actions .bulk-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.bulk-actions select,
.bulk-actions input[type="number"] {
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.875rem;
}

.bulk-actions .btn {
    height: 32px;
    padding: 0 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.bulk-actions .btn-primary {
    background: #007bff;
    color: white;
}

.bulk-actions .btn-primary:hover {
    background: #0056b3;
}

.bulk-actions .btn-danger {
    background: #dc3545;
    color: white;
}

.bulk-actions .btn-danger:hover {
    background: #c82333;
}

/* === Status pill (контрастная «пилюля») === */

/* Отступы между крупными блоками внутри main */
.main-section {
  margin-bottom: 32px;
}

/* Универсальные заголовки секций */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
}

.section-caption {
  font-size: 13px;
  color: var(--muted);
}

/* === Vertical rhythm between sections (global) === */
.main-section > * + * {
  margin-top: 32px;
}

/* ============================== ANALYTICS 3.0 STYLES ============================ */
/* Wide panels for full-width layout - kept for table sections */
.wide-panel {
  width: 100%;
  background: var(--panel);
  border: 1px solid color-mix(in oklab, var(--border), transparent 35%);
  border-radius: 20px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
  margin-bottom: 32px;
}

.wide-panel .panel-header {
  padding: 24px 32px 20px;
  border-bottom: 1px solid var(--border);
}

.wide-panel .panel-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.wide-panel .panel-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 8px 0 0;
}

/* Updated table panel for wide layout */
.table-panel {
  padding: 0;
  overflow: visible;
}

.table-panel table {
  margin: 0;
  border-collapse: collapse;
}

.wide-panel .table-panel {
  padding: 24px 32px;
}

/* Remove old grid styles - no longer needed for tables, but kept for KPI */

/* ============================== NEW: Game Rows (Two-Layer Design) ============================ */

.game-row-main {
  display: flex;
  align-items: center;
  width: 100%;
}

.game-main-grid {
  display: grid;
  grid-template-columns: 140px 120px 140px 1fr 100px 80px;
  gap: 16px;
  align-items: center;
  width: 100%;
}

.game-col-date,
.game-col-type,
.game-col-status,
.game-col-host,
.game-col-players,
.game-col-actions {
  display: flex;
  align-items: center;
}

.game-col-date input,
.game-col-type select,
.game-col-host select {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 14px;
  color: #374151;
}

.game-col-status {
  justify-content: center;
}

.game-col-players {
  justify-content: center;
  font-weight: 500;
  color: #6b7280;
}

.game-col-actions {
  justify-content: flex-end;
  gap: 8px;
}

.game-details-wrapper {
  background: #f9fafb;
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 6px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.details-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.details-section h4 {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.detail-group h4 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

.detail-group p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

.detail-group .inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.detail-group input {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
}

.full-width {
  grid-column: 1 / -1;
}

.actions-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 24px !important;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.actions-row .btn {
  min-width: 90px;
  padding: 8px 14px;
  font-size: 14px;
  text-align: center;
}

.btn-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  font-size: 16px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-icon:hover {
  background: #e5e7eb;
  color: #374151;
}

.menu-trigger {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  font-size: 16px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.menu-trigger:hover {
  background: #e5e7eb;
  color: #374151;
}

.menu-popover {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  display: none;
  z-index: 10;
  min-width: 120px;
}

.menu-popover.open {
  display: block;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 6px 10px;
  text-align: left;
  border-radius: 6px;
  font-size: 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #374151;
}

.menu-item:hover {
  background: #f2f2f2;
}

.menu-item.delete {
  color: #D9534F;
}

.menu-item.delete:hover {
  background: #ffeaea;
}

.status-badge {
  display: inline-block;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  min-width: 80px;
  color: #fff;
  border: none;
  background: transparent;
  cursor: pointer;
}

.status-pill {
  position: relative;
}

/* Events table styles */
thead {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 5;
}

thead th {
  font-weight: 600;
  color: #5e6278;
  padding: 14px 16px;
  background: #f9fafb;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.game-row td {
  vertical-align: middle;
  padding: 10px 12px;
}

.game-row {
  height: 56px;
}

.column-type {
  min-width: 180px;
}

.column-host {
  width: 120px;
  white-space: nowrap;
}

.column-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 80px;
  text-align: right;
  vertical-align: middle;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.column-check {
  width: 44px;
  text-align: center;
}

.column-date {
  width: 160px;
}

.column-status {
  width: 160px;
}

.column-status select {
  width: 150px;
  box-sizing: border-box;
}

.actions-row .btn {
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 14px;
}

.actions-row .btn-error {
  background: #ef4444;
  color: white;
}

.actions-row .btn-primary {
  background: #2563eb;
  color: white;
}

.column-players {
  width: 180px;
}

.column-extras {
    width: 70px;
    text-align: center;
    vertical-align: middle;
}

.game-input-extras {
    width: 60px;
    height: 36px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

/* Game status pill (select inside table) */
.status-select {
  width: 150px;
  height: 36px;
  padding: 4px 12px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  color: #ffffff;
  background: #e5e7eb; /* дефолт на всякий случай */
}

/* planned = жёлто-оранжевый */
.status-select.is-planned {
  background: #f97316;
  color: #ffffff;
}

/* done = зелёный */
.status-select.is-done {
  background: #16a34a;
  color: #ffffff;
}

/* canceled = красный */
.status-select.is-canceled {
  background: #dc2626;
  color: #ffffff;
}

.status-select option {
    color: #000; /* обычный текст */
    background: #fff;
}

/* Details row */
.game-row-details {
  display: none;
  padding: 0;
  margin: 0;
}
.game-row.open + .game-row-details {
  display: table-row;
}

.game-row-details td {
  padding: 0;
}

/* STATUS SELECT — FIX TEXT ALIGN + CENTERING */

.status-select {
    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center !important;
    padding: 4px 12px !important;
    color: #fff !important;
}

.status-select option {
    text-align: left;
    color: #000;
}

.fund-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.export-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}
.export-row input {
    width: 160px;
}
.export-btn {
    white-space: nowrap;
    position: relative;
    z-index: 5;
}
.extras-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}
.extras-row input {
    width: 160px;
}

/* ============================== FUND UI v3 STYLES ============================ */

/* Hero fund block */
.hero-fund {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    padding: 4rem 2rem;
    border-radius: 16px;
    text-align: left;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.3), 0 4px 16px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    animation: heroFadeIn 450ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-fund::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.1), transparent 50%);
    pointer-events: none;
}

.hero-fund-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    opacity: 0.85;
}

.hero-fund-amount {
    font-size: 4rem;
    font-weight: 800;
    margin: 1.5rem 0;
    display: block;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.hero-fund-subtitle {
    font-size: 1rem;
    opacity: 0.8;
    font-weight: 400;
    margin-top: 1rem;
}

/* Прогноз «к концу сезона ожидается» — под основной суммой.
   Приглушён намеренно: это оценка, а не собранные деньги. */
.hero-fund-forecast {
    font-size: 1rem;
    opacity: 0.85;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.hero-fund-forecast strong {
    font-size: 1.35rem;
    font-weight: 700;
}

.hero-fund-forecast-hint {
    display: block;
    font-size: 0.8125rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.hero-watermark {
    position: absolute;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    width: 80px;
    height: 80px;
    opacity: 0.1;
    pointer-events: none;
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Status indicators */
.status-enabled {
    color: var(--success, #10b981);
    font-weight: bold;
}

.status-disabled {
    color: var(--muted);
    font-weight: normal;
}

/* Collapsible panels */
.panel-collapsible {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.panel-collapsible summary {
    cursor: pointer;
    padding: 1rem 1.5rem;
    background: var(--panel);
    border-radius: 8px;
    list-style: none;
}

.panel-collapsible summary:hover {
    background: var(--primary-10);
}

.panel-collapsible summary::marker {
    content: "▶ ";
    color: var(--primary);
    font-size: 0.875rem;
}

.panel-collapsible[open] summary::marker {
    content: "▼ ";
}

.panel-collapsible .panel-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.panel-collapsible .table-responsive {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

/* Table total row */
.table-total {
    background: var(--primary-10);
    font-weight: 600;
}

.table-total td {
    border-top: 2px solid var(--primary-500);
}

/* Warnings panel */
.panel--warning {
    border-color: var(--warn);
    background: var(--warn-100);
}

.warnings-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
}

.warnings-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--warn-100);
}

.warnings-list li:last-child {
    border-bottom: none;
}

/* Bulk actions */
.bulk-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 24px;
  padding: 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 20px;
}

.bulk-actions__info h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.bulk-actions__info p {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

.bulk-actions__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bulk-actions__controls select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}

.bulk-actions__controls button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
}

.bulk-actions__danger {
  display: flex;
  align-items: center;
  opacity: 0.9;
}

.bulk-actions__danger:hover {
  opacity: 1;
}

.bulk-actions__danger button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  background: var(--error);
  color: white;
}
/* ====================== ЭКРАН ВХОДА ===================== */
/* Композиция вокруг логотипа: неоновый ореол, как свечение
   вокруг енота на фирменном знаке. */

.login-screen {
  min-height: calc(100vh - 220px);
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Мягкое неоновое пятно за логотипом */
.login-glow {
  position: absolute;
  top: -90px;
  left: 50%;
  width: 260px;
  height: 260px;
  transform: translateX(-50%);
  background: radial-gradient(
    circle,
    color-mix(in oklab, var(--neon), transparent 78%) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.login-logo {
  position: relative;
  width: 96px;
  height: 96px;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 14px color-mix(in oklab, var(--neon), transparent 60%));
}

.login-title {
  position: relative;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.login-subtitle {
  position: relative;
  margin: 0.375rem 0 1.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.login-form {
  position: relative;
  display: grid;
  gap: 0.75rem;
  text-align: left;
}

.login-input {
  width: 100%;
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.login-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--neon), transparent 82%);
  outline: none;
}

.login-btn {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.7rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.login-error {
  position: relative;
  margin-bottom: 1rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--error);
  background: var(--error-100);
  border-radius: var(--radius-sm);
}

/* ====================== ДАШБОРД ===================== */
/* Строка ключевых цифр: фонд, игры, ближайшие. */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--primary);
  text-decoration: none;
}

.stat-link:hover { text-decoration: underline; }

.section-meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Пустое состояние вместо голой пустоты в таблице */
.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
}

.empty-state-text {
  margin-bottom: 0.875rem;
  color: var(--muted);
}

/* Пагинация */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--muted);
}

.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ====================== МОБИЛЬНАЯ ШАПКА ===================== */
/* На узких экранах 11 пунктов меню переносились в две-три строки
   и занимали пол-экрана. Прячем их за кнопку. */

.menu-toggle { display: none; }

@media (max-width: 860px) {

  /* кнопка-бургер вместо строки пунктов */
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.25rem;
    line-height: 1;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
  }

  .menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 40;
    display: none;
    padding: 8px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  /* раскрытие без JS: чекбокс в шапке */
  #menu-switch:checked ~ .menu { display: block; }

  .menu ul {
    flex-direction: column;
    gap: 2px;
  }

  .menu a {
    display: block;
    padding: 12px 14px;   /* палец, а не курсор: не меньше 44px по высоте */
  }
}

/* Таблицы на мобильном скроллятся вбок, а не ломают вёрстку */
@media (max-width: 640px) {
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 520px; }

  .stat-row { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.5rem; }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .hero-fund-amount { font-size: 2.5rem; }
  .pagination { gap: 0.5rem; }
}

/* Скрыто визуально, но доступно скринридеру и CSS-селекторам */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* На мобильном подменю раскрывается в общий список, без всплытия */
@media (max-width: 860px) {
}

/* ====================== МАКЕТ С БОКОВЫМ МЕНЮ ===================== */
/* Панель управления слева: для админки с 10+ разделами это удобнее
   верхнего меню — все пункты видны сразу, подменю не нужно. */

.layout {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

/* На странице входа сайдбара нет — одна колонка */
.layout-plain { grid-template-columns: 1fr; }

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 12px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  text-decoration: none;
  color: var(--text);
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-brand-text strong { font-size: 0.9375rem; font-weight: 700; }
.sidebar-brand-text small { font-size: 0.75rem; color: var(--muted); }

.sidebar-nav { flex: 1; }

.sidebar-group { margin-bottom: 18px; }

.sidebar-group-title {
  padding: 0 10px 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  text-decoration: none;
  color: var(--text);
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: color-mix(in oklab, var(--panel), var(--border) 45%);
}

/* Активный раздел — полоской фирменного цвета, а не заливкой:
   заливка неоном слишком кричит на каждом экране */
.sidebar-link.active {
  border-left-color: var(--primary);
  background: color-mix(in oklab, var(--primary), transparent 90%);
  color: var(--primary-600);
  font-weight: 600;
}

.sidebar-icon {
  width: 20px;
  text-align: center;
  font-size: 0.9375rem;
}

.sidebar-footer {
  display: flex;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .btn { flex: 1; }

/* Верхняя полоса основной колонки */
.layout-main {
  display: flex;
  flex-direction: column;
  min-width: 0;   /* иначе широкие таблицы растягивают грид */
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 24px;
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-title { font-weight: 600; }

.layout-main .main {
  flex: 1;
  padding: 22px 24px 40px;
  max-width: 1200px;
  width: 100%;
}

.sidebar-overlay { display: none; }

/* ---- мобильный режим: сайдбар выезжает поверх ---- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  #menu-switch:checked ~ .layout .sidebar { transform: translateX(0); }

  #menu-switch:checked ~ .layout .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.45);
  }

  .layout-main .main { padding: 18px 16px 32px; }
  .topbar { padding: 0 16px; }
}

/* На широких экранах кнопка-бургер не нужна */
@media (min-width: 901px) {
  .menu-toggle { display: none; }
}

/* ====================== ГРАФИК ДИНАМИКИ ФОНДА ===================== */
/* Инлайновый SVG без библиотек: одна ломаная и заливка под ней. */

.chart-wrap { padding: 8px 4px 0; }

.chart {
  display: block;
  width: 100%;
  height: 160px;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  /* толщина не должна тянуться вместе с viewBox */
  vector-effect: non-scaling-stroke;
}

.chart-area {
  fill: color-mix(in oklab, var(--primary), transparent 88%);
  stroke: none;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  padding: 6px 2px 2px;
  font-size: 0.75rem;
  color: var(--muted);
}

.chart-legend {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.chart-legend-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary-600);
}
