/* ==========================================================================
   ФК «Элеватор» — оформление приложения.
   Светлая красно-белая тема: белые поверхности, светлый серый фон,
   красные кнопки и активные элементы. Синий используется только для
   синей команды. Тёмная тема не предусмотрена (требование ТЗ).
   ========================================================================== */

:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-2: #fbfaf8;
  --offset: #f0ede9;
  --border: #ddd8d2;
  --text: #262321;
  --muted: #6d6965;
  --faint: #918c87;
  --primary: #b92323;
  --primary-hover: #991b1b;
  --primary-soft: #fbe9e7;
  --blue: #1766b1;
  --blue-soft: #eaf2fb;
  --success: #26733b;
  --success-soft: #eaf6ed;
  --warn: #a25b00;
  --warn-soft: #fff4df;
  --danger: #a91f19;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(46 37 31 / 5%), 0 8px 24px rgb(46 37 31 / 6%);
  --sidebar-width: 248px;
  --topbar-height: 66px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1 { font-size: clamp(1.5rem, 1.3rem + 0.7vw, 2rem); }
h2 { font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.4rem); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; }
:focus-visible { outline: 3px solid rgb(185 35 35 / 35%); outline-offset: 2px; }
.skip-link {
  position: fixed; left: 16px; top: -70px; z-index: 1000;
  background: var(--primary); color: #fff; padding: 11px 16px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

/* Иконки ---------------------------------------------------------------- */
.icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.icon--sm { width: 15px; height: 15px; }

/* Каркас ---------------------------------------------------------------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width);
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto; z-index: 40;
}
.sidebar-nav { flex: 1 1 auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; color: inherit; }
.brand-mark { 
  width: 38px; 
  height: 38px; 
  color: var(--primary); 
  border-radius: 50%; /* Делает логотип круглым. Если не нужно, удали эту строку */
  object-fit: cover;
}
.brand-copy strong { display: block; font-size: 16px; }
.brand-copy small { display: block; color: var(--muted); font-size: 12px; }
.nav-group { margin-bottom: 14px; }
.nav-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint); padding: 0 12px 7px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; min-height: 44px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: var(--muted);
  margin-bottom: 3px;
}
.nav-link:hover { background: var(--offset); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }

.topbar {
  position: fixed; inset: 0 0 auto var(--sidebar-width); height: var(--topbar-height);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; gap: 14px; z-index: 35;
}
.top-title { 
  font-weight: 700; 
  font-size: 16px;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.2;
  word-break: break-word;
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--offset); color: var(--text); }
.notification-dot {
  position: absolute; top: 8px; right: 9px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--primary);
}
.user-chip {
  display: inline-flex; align-items: center; gap: 9px; padding: 5px 11px 5px 5px;
  border: 1px solid var(--border); border-radius: 999px; font-weight: 600;
  font-size: 14px; color: inherit; background: var(--surface);
}
.user-chip:hover { background: var(--offset); }
.mobile-menu { display: none; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.content { margin-left: var(--sidebar-width); padding-top: var(--topbar-height); min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1 1 auto; padding: 26px 28px 40px; max-width: 1400px; width: 100%; }
.site-footer {
  border-top: 1px solid var(--border); padding: 18px 28px; font-size: 13px;
  color: var(--muted); display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; }
.bottom-nav { display: none; }

/* Заголовок страницы ---------------------------------------------------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--primary); margin-bottom: 5px;
}
.actions { display: flex; flex-wrap: wrap; gap: 9px; }
.section { margin-top: 24px; }
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.section-title h2, .section-title h3 { margin: 0; }
.muted { color: var(--muted); }
.text-red { color: var(--primary); }
.text-blue { color: var(--blue); }
.text-success { color: var(--success); }
.text-warn { color: var(--warn); }
.nowrap { white-space: nowrap; }

/* Карточки -------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card + .card { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.kpi > span:first-child { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi strong { display: block; font-size: 26px; line-height: 1.2; margin-top: 4px; }
.kpi small { display: block; color: var(--muted); font-size: 13px; }
.notice {
  padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border); font-size: 14px;
}
.notice.success { background: var(--success-soft); border-color: #b9e0c4; color: #1d5a2d; }
.notice.warn { background: var(--warn-soft); border-color: #f0d9a8; color: #7a4500; }
.notice.error { background: var(--primary-soft); border-color: #f2c2bd; color: #8c1a15; }
.flow-note {
  margin-top: 14px; padding: 10px 12px; border-left: 3px solid var(--primary);
  background: var(--surface-2); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--muted);
}
.empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }

/* Бейджи ---------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--offset); color: #44403c; white-space: nowrap;
}
.badge--red { background: var(--primary-soft); color: #8c1a15; }
.badge--blue { background: var(--blue-soft); color: #12507f; }
.badge--green { background: var(--success-soft); color: #1d5a2d; }
.badge--warn { background: var(--warn-soft); color: #7a4500; }
.badge--neutral { background: var(--offset); color: #44403c; }
.badge--score { background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.badge--live { background: var(--primary-soft); color: #8c1a15; }
.badge--gold { background: #fff6da; color: #8a6300; }

/* Герой главной страницы ------------------------------------------------ */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr);
  gap: 22px; padding: 26px; align-items: center;
}
.hero-copy h1 { margin-bottom: 10px; }
.hero-copy p { color: var(--muted); margin-bottom: 16px; }
.score-panel {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center;
}
.score { font-size: 44px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 12px; }
.score span.sep { color: var(--faint); font-size: 30px; }
.score-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* Матчи ----------------------------------------------------------------- */
.match-row {
  display: grid; grid-template-columns: 130px minmax(0, 1fr) auto;
  gap: 16px; align-items: center; padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.match-row:last-child { border-bottom: 0; }
.match-row .date strong { display: block; font-size: 16px; }
.match-row .date span { color: var(--muted); font-size: 13px; }
.match-main h3 { margin: 0 0 6px; }
.match-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.past-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.past-card { padding: 18px; }
.past-score { font-size: 32px; font-weight: 800; margin: 12px 0 6px; display: flex; gap: 10px; align-items: baseline; }
.past-score .sep { color: var(--faint); font-size: 22px; }

.past-score-cup {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}
.past-score-cup strong { font-size: 16px; color: var(--text); }
.past-score-cup .text-red { color: var(--primary); }
.past-score-cup .text-blue { color: var(--blue); }

.match-header {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px;
  align-items: center; padding: 22px; text-align: center;
}
.match-header .team-side { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.team-name { font-weight: 700; }
.big-score { font-size: 46px; font-weight: 800; display: flex; gap: 10px; justify-content: center; min-width: 150px; }
.big-score .sep { color: var(--faint); }

/* Команды и списки людей ------------------------------------------------ */
.teams, .split-3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.split-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.team-card { padding: 18px; }
.team-card.red-team { border-top: 3px solid var(--primary); }
.team-card.blue-team { border-top: 3px solid var(--blue); }
.people-list { display: flex; flex-direction: column; gap: 8px; }
.person { display: flex; align-items: center; gap: 10px; }
.person-info strong { display: block; font-size: 14px; }
.person-info small { color: var(--muted); font-size: 12px; }
.draggable {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; margin-bottom: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: grab; font-size: 14px;
}
.draggable:active { cursor: grabbing; }
.dropzone { padding: 16px; min-height: 180px; }
.dropzone h3 { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.dropzone.drag-over { border-color: var(--primary); background: var(--primary-soft); }
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px;
}

/* Таблицы --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--surface-2); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .right, .right { text-align: right; }
.matrix { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.matrix th, .matrix td { border: 1px solid var(--border); padding: 7px 10px; text-align: center; min-width: 58px; }
.matrix thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; }
.matrix tbody th { position: sticky; left: 0; background: var(--surface-2); text-align: left; z-index: 1; }
.matrix td.blocked { background: var(--offset); color: var(--faint); }
.matrix td.editable { cursor: pointer; background: var(--surface); }
.matrix td.editable:hover { background: var(--primary-soft); }
.matrix td.edited { background: var(--warn-soft); font-weight: 700; }
.matrix-wrap { max-width: 100%; overflow-x: auto; }

/* Формы ----------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 600; color: #44403c; }
.field .help, .help { font-size: 12px; color: var(--muted); }
.input, .select, .textarea, .form-control, .form-select {
  width: 100%; padding: 9px 11px; font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.textarea { min-height: 82px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid rgb(185 35 35 / 25%); border-color: var(--primary); }
.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filterbar .input, .filterbar .select { width: auto; min-width: 180px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* Кнопки ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  background: var(--offset); color: var(--text); text-decoration: none; line-height: 1.2;
}
.btn:hover { background: #e7e2dc; color: var(--text); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--offset); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #12507f; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8c1a15; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1d5a2d; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-lg { padding: 14px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: 0.55; cursor: not-allowed; }

/* Опрос участия --------------------------------------------------------- */
.poll-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 18px; }
.poll-choice, .participants { padding: 20px; }
.poll-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.poll-actions .btn { min-height: 56px; font-size: 16px; }
.poll-page { max-width: 760px; margin: 0 auto; padding: 28px 18px 60px; }
.poll-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }

/* Табло матча ----------------------------------------------------------- */
.scoreboard { max-width: 720px; margin: 0 auto; }
.scoreboard-display { padding: 22px; text-align: center; }
.scoreboard-display .score { font-size: 64px; }
.goal-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.goal-btn { min-height: 98px; font-size: 19px; font-weight: 700; border-radius: var(--radius); border: 0; color: #fff; cursor: pointer; }
.red-goal { background: var(--primary); }
.red-goal:hover { background: var(--primary-hover); }
.blue-goal { background: var(--blue); }
.blue-goal:hover { background: #12507f; }
.goal-btn:disabled { opacity: 0.6; }
.event-list { display: flex; flex-direction: column; gap: 8px; }
.event {
  display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 10px;
  align-items: center; padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px;
}
.event .time { color: var(--muted); font-size: 13px; }

/* Оценки ---------------------------------------------------------------- */
.rating-list { display: flex; flex-direction: column; gap: 12px; }
.rating-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 14px; align-items: center; }
.numbers { display: flex; gap: 5px; flex-wrap: wrap; }
.num {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-weight: 600; font-size: 14px;
}
.num:hover { border-color: var(--primary); }
.num.selected, .num.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Комментарии ----------------------------------------------------------- */
.comment { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 12px; }
.comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment-head .meta { color: var(--muted); font-size: 12px; }
.comment-body { font-size: 14px; white-space: pre-line; }
.comment-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; font-size: 13px; }
.comment-actions button { background: none; border: 0; cursor: pointer; color: var(--muted); font: inherit; }
.comment-actions button:hover { color: var(--primary); }
.comment.deleted .comment-body { color: var(--faint); font-style: italic; }
.replies { margin: 12px 0 0 24px; display: flex; flex-direction: column; gap: 10px; }

/* Графики и прочее ------------------------------------------------------ */
.bar-chart { display: flex; align-items: flex-end; gap: 18px; height: 190px; padding-top: 12px; }
.bar-group { flex: 1 1 0; display: flex; align-items: flex-end; gap: 5px; justify-content: center; height: 100%; position: relative; }
.bar { width: 22px; border-radius: 4px 4px 0 0; min-height: 3px; }
.red-bar { background: var(--primary); }
.blue-bar { background: var(--blue); }
.bar-label { position: absolute; bottom: -22px; font-size: 12px; color: var(--muted); }
.chart-legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.progress-bar { height: 8px; background: var(--offset); border-radius: 999px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--primary); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 9px 13px; border: 0; background: none; cursor: pointer; font: inherit;
  font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #2b2826; color: #fff; padding: 12px 18px; border-radius: 999px;
  font-size: 14px; z-index: 200; box-shadow: var(--shadow); max-width: 90vw;
}
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-row input { flex: 1 1 260px; }
.link-box {
  font-family: Consolas, "Courier New", monospace; font-size: 13px; word-break: break-all;
  background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.legal-text { white-space: pre-line; font-size: 14px; line-height: 1.65; }
.legal-text h2 { margin-top: 22px; }
.error-page { max-width: 560px; margin: 60px auto; text-align: center; }

/* Вход ------------------------------------------------------------------ */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px 16px; background: var(--bg);
}
.login-card { width: 100%; max-width: 430px; padding: 28px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-links { margin-top: 18px; font-size: 13px; color: var(--muted); }
.login-hint { margin-top: 14px; font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }

/* Адаптивность ---------------------------------------------------------- */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  :root { --sidebar-width: 84px; }
  .brand-copy, .nav-link span, .nav-label, .sidebar-footer { display: none; }
  .brand { justify-content: center; padding-inline: 0; }
  .nav-link { justify-content: center; }
  .grid-3, .grid-2, .kpi-grid, .past-grid, .teams, .split-3, .form-grid, .poll-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  :root { --topbar-height: 60px; }
  body { padding-bottom: 66px; }
  .sidebar { transform: translateX(-100%); transition: transform 0.18s ease; width: min(300px, 88vw); box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .brand-copy, .nav-link span, .nav-label, .sidebar-footer { display: block; }
  .nav-link { justify-content: flex-start; }
  .topbar { left: 0; padding: 0 12px; }
  .mobile-menu { display: inline-flex; }
  .user-chip .user-name { display: none; }
  .top-logo { display: none; } /* Скрываем логотип в шапке на мобильных */
  /* Обрезаем длинный заголовок страницы в шапке на мобильных */
  .top-title { 
    font-size: 14px; 
    white-space: normal; 
  }
  .topbar > .top-actions:first-child { 
    flex: 1 1 auto; 
    min-width: 0; 
    /* overflow: hidden; — убрали, чтобы текст не обрезался */
  }
  .topbar > .top-actions:last-child { 
    flex-shrink: 0; 
  }
  .content { margin-left: 0; }
  .main { padding: 18px 14px 30px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .hero, .grid-2, .grid-3, .grid-4, .kpi-grid, .past-grid, .teams, .split-3,
  .form-grid, .goal-buttons, .poll-layout, .poll-actions { grid-template-columns: 1fr; }
  .match-row { grid-template-columns: 1fr; gap: 10px; }
  .match-header { grid-template-columns: 1fr; }
  .big-score { font-size: 40px; }
  .rating-row { grid-template-columns: 1fr; }
  .numbers { overflow-x: auto; padding-bottom: 4px; }
  .filterbar .input, .filterbar .select { width: 100%; }
  .site-footer { flex-direction: column; padding: 16px 14px 22px; }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 38; height: 66px;
    background: var(--surface); border-top: 1px solid var(--border);
    display: grid; grid-template-columns: repeat(5, 1fr);
  }
  .bottom-link {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; font-size: 11px; color: var(--muted); padding: 6px 2px;
  }
  .bottom-link.active { color: var(--primary); }
  /* Таблицы превращаются в карточки, горизонтальная прокрутка не блокируется. */
  .data-table.mobile-cards thead { display: none; }
  .data-table.mobile-cards, .data-table.mobile-cards tbody, .data-table.mobile-cards tr, .data-table.mobile-cards td { display: block; width: 100%; }
  .data-table.mobile-cards tr { padding: 12px; border-bottom: 1px solid var(--border); }
  .data-table.mobile-cards td { border: 0; padding: 4px 0; }
  .data-table.mobile-cards td::before {
    content: attr(data-label); display: inline-block; width: 44%;
    font-size: 12px; color: var(--muted);
  }
}
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .numbers .num { width: 32px; height: 32px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .actions, .site-footer { display: none !important; }
  .content { margin: 0; padding: 0; }
  .card { box-shadow: none; }
}

/* Оценки игроков: подсветка незаполненных строк */
.rating-row { padding: 8px 0; border-radius: 6px; transition: background .2s; }
.rating-row--pending { background: #fff9e6; padding-left: 10px; padding-right: 10px; }

/* Карточка матча: крупный счёт и кубок */
.score-block { text-align: center; }
.score-label {
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 4px;
}
.big-score--xl { font-size: 64px; line-height: 1; }
.big-score--xl .sep { font-size: 44px; }
.score-cup {
  margin-top: 8px; font-size: 14px; color: var(--muted);
}
.score-cup strong { color: var(--text); font-size: 16px; }
.score-flags { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.score-mvp {
  margin-top: 10px; font-size: 13px; color: var(--muted);
}
.score-mvp strong { color: var(--text); }

/* Виджет погоды */
.weather-widget { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.weather-widget__top { display: flex; align-items: center; gap: 14px; }
.weather-widget__temp {
  font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -0.02em;
}
.weather-widget__cond { color: var(--muted); font-size: 13px; }
.weather-widget__rows { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.weather-widget__rows .task { padding: 8px 10px; font-size: 13px; }

/* Компактный список игроков под шапкой */
.players-block__list { display: flex; flex-direction: column; gap: 8px; }
.players-block__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 767px) {
  .players-block__cols { grid-template-columns: 1fr; }
  .big-score--xl { font-size: 48px; }
  .big-score--xl .sep { font-size: 32px; }
}

/* Универсальный двух-колоночный блок «Игроки + погода» */
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 767px) { .info-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   Выравнивание KPI карточек (Статистика игроков)
   ========================================================================== */
.kpi-grid {
    align-items: stretch;
}

.kpi-grid .kpi {
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

/* Отменяем глобальный отступ для карточек внутри сетки KPI */
.kpi-grid .card + .card {
    margin-top: 0;
}

.kpi-grid .kpi strong {
    margin-bottom: 8px;
}

.kpi-grid .kpi small {
    margin-top: auto;
    padding-top: 8px;
    line-height: 1.4;
    display: block;
}

/* Исправление выравнивания карточек в сетках */
.grid-2 .card + .card {
    margin-top: 0; /* Убираем глобальный отступ */
}

.grid-2 > section.card {
    height: 100%; /* Карточки растягиваются на всю высоту */
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Выравнивание карточек прошедших матчей на главной
   ========================================================================== */
.past-grid {
    align-items: stretch; /* Растягиваем карточки на одинаковую высоту */
}

.past-grid .card + .card {
    margin-top: 0; /* Убираем глобальный отступ у второй карточки */
}

.past-card {
    display: flex;
    flex-direction: column;
    height: 100%; /* Занимаем всю высоту сетки */
}

.past-card .actions {
    margin-top: auto !important; /* Принудительно прижимаем кнопки к низу */
    padding-top: 16px; /* Немного отступа от текста, если его много */
}

/* ==========================================================================
   Индикаторы формы и статистика на главной
   ========================================================================== */
.form-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.form-dot--win { background-color: #26733b; }
.form-dot--loss { background-color: #b92323; }
.form-dot--draw { background-color: #ddd8d2; }

/* Плашка со статистикой голов */
.match-stats-box {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
}
.match-stats-box strong {
  color: var(--text);
  font-size: 14px;
  margin-left: 2px;
}

/* ==========================================================================
   Системное исправление выравнивания карточек в сетках
   ========================================================================== */
.grid-2 > .card + .card,
.grid-3 > .card + .card,
.grid-4 > .card + .card,
.split-3 > .card + .card,
.teams > .card + .card,
.past-grid > .card + .card,
.kpi-grid > .card + .card {
    margin-top: 0 !important;
}

/* Растягиваем карточки на всю высоту ячейки */
.grid-2 > .card,
.grid-3 > .card,
.grid-4 > .card,
.split-3 > .card,
.teams > .card {
    height: 100%;
}

/* --- Плавающая панель смайлов в комментариях --- */
.comment-textarea-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
}

.comment-textarea-wrapper textarea {
  /* Оставляем место внизу, чтобы текст не заезжал под смайлики */
  padding-bottom: 40px !important; 
  resize: vertical;
  min-height: 80px;
}

.floating-emoji-bar {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: rgba(255, 255, 255, 0.95);
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border, #ddd);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  z-index: 10;
}

.floating-emoji-bar .emoji-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.2s;
}

.floating-emoji-bar .emoji-btn:hover {
  background: #f0f0f0;
}

.floating-emoji-bar .emoji-btn img {
  height: 18px;
  width: 18px;
  vertical-align: middle;
  object-fit: contain;
}

/* --- Плавающая панель смайлов и клубов в комментариях --- */
.comment-textarea-wrapper {
  position: relative !important;
  display: block !important;
  width: 100% !important;
}

.comment-textarea-wrapper textarea {
  /* Оставляем место внизу, чтобы текст не заезжал под смайлики */
  padding-bottom: 45px !important; 
  width: 100%;
  box-sizing: border-box;
}

.floating-emoji-bar {
  position: absolute !important;
  bottom: 8px !important;
  right: 8px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 4px !important;
  background: rgba(255, 255, 255, 0.95) !important;
  padding: 4px 8px !important;
  border-radius: 8px !important;
  border: 1px solid var(--border, #ddd) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  z-index: 10 !important;
}

.floating-emoji-bar .emoji-btn {
  background: none !important;
  border: none !important;
  padding: 2px !important;
  margin: 0 !important;
  cursor: pointer;
  font-size: 18px !important;
  line-height: 1 !important;
  border-radius: 4px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  transition: background 0.2s;
}

.floating-emoji-bar .emoji-btn:hover {
  background: #f0f0f0 !important;
}

/* Жёстко фиксируем размер картинок клубов */
.floating-emoji-bar .emoji-btn img {
  height: 20px !important;
  width: 20px !important;
  max-height: 20px !important;
  max-width: 20px !important;
  object-fit: contain !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
}

/* Логотип в верхней панели (рядом с заголовком) */
.top-logo {
  width: 38px;   /* Увеличили с 28 до 38, чтобы было вровень с кнопками (они по 40px) */
  height: 38px;
  object-fit: contain;
  border-radius: 50%; /* Делает круглым */
  margin-left: 14px;  /* Чуть увеличили отступ от текста "Главная" */
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--border); /* Добавит едва заметную рамку, чтобы логотип не сливался с белым фоном */
}
/* Иконка в виджете погоды */
.weather-widget__top .icon {
  width: 32px;
  height: 32px;
  stroke-width: 1.5;
}

/* --- Cookie Banner --- */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
}

.cookie-banner p {
  margin: 0;
  line-height: 1.5;
  color: var(--muted);
}

.cookie-banner a {
  color: var(--primary);
  text-decoration: underline;
}

.cookie-banner-actions {
  display: flex;
  justify-content: flex-end;
}

/* Адаптив для мобильных (учитываем высоту нижнего меню 66px) */
@media (max-width: 767px) {
  .cookie-banner {
    bottom: 0;
    right: 0;
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
    margin-bottom: 66px; /* Высота .bottom-nav */
    padding: 16px;
  }
}

/* --- Поповер для матрицы оценок --- */
.matrix-popover {
  position: fixed;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  width: 60px;
  max-height: 120px; /* Высота ровно в 3 кнопки */
  overflow-y: auto;
}

.matrix-popover button {
  background: none;
  border: none;
  padding: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.2s;
  text-align: center;
}

.matrix-popover button:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.matrix-popover button:last-child {
  border-bottom: none;
}

/* Модификатор для меню MVP (шире, текст слева) */
.matrix-popover.matrix-popover--mvp {
  width: 220px !important;
  display: block; /* <--- Убрали !important */
  padding: 0 !important;
}

.matrix-popover.matrix-popover--mvp button {
  display: block !important;
  width: 100% !important;
  text-align: left;
  font-weight: normal;
  font-size: 13px;
  padding: 8px 12px !important;
  border-bottom: 1px solid var(--border) !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
}

.matrix-popover.matrix-popover--mvp button:last-child {
  border-bottom: none !important;
}

.matrix-popover.matrix-popover--mvp button:hover {
  background: var(--warn-soft);
  color: var(--warn);
}

.weather-icon-lg { width: 28px; height: 28px; stroke-width: 1.8; }