/* ========================================
   MATCHDIARY — ОСНОВНЫЕ НАСТРОЙКИ
======================================== */

:root {
    --bg: #0b1120;
    --bg-secondary: #111a2c;
    --card: #151f32;
    --card-hover: #1c2940;
    --input: #0e1728;

    --primary: #22c55e;
    --primary-hover: #16a34a;
    --primary-light: rgba(34, 197, 94, 0.12);

    --text: #f8fafc;
    --muted: #94a3b8;
    --border: #29364b;

    --radius: 14px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button,
input {
    transition:
        border-color 0.2s,
        background 0.2s,
        box-shadow 0.2s;
}

/* ========================================
   ШАПКА
======================================== */

.site-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1180px;
    margin: auto;
    padding: 18px 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;

    font-size: 23px;
    font-weight: 800;
    letter-spacing: -0.7px;
}

.logo-icon {
    font-size: 26px;
}

.logo-accent {
    color: var(--primary);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-link {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 18px;

    padding-left: 25px;
    border-left: 1px solid var(--border);
}

.username {
    font-size: 14px;
    font-weight: 600;
}

.logout-btn {
    background: transparent;
    color: var(--muted);
    border: none;
    font-size: 13px;
}

.logout-btn:hover {
    color: #fff;
}

/* ========================================
   ОСНОВНОЙ КОНТЕЙНЕР
======================================== */

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 45px 24px 70px;
}

/* ========================================
   ПРИВЕТСТВИЕ
======================================== */

.welcome-section {
    margin-bottom: 35px;
}

.section-eyebrow {
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.welcome-section h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.8px;
    margin-bottom: 8px;
}

.welcome-section p {
    color: var(--muted);
    font-size: 15px;
}

/* ========================================
   КАРТОЧКИ СТАТИСТИКИ
======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 35px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;

    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    opacity: 0.7;
}

.stat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.stat-icon {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--primary-light);
    border-radius: 10px;
    font-size: 19px;
}

.stat-number {
    font-size: 38px;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 10px;
}

.stat-bottom {
    color: var(--muted);
    font-size: 12px;
}

/* ========================================
   ПАНЕЛЬ ДОБАВЛЕНИЯ МАТЧА
======================================== */

.match-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 32px;
    margin-bottom: 40px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.panel-header h2 {
    font-size: 24px;
    letter-spacing: -0.5px;
    margin-bottom: 5px;
}

.panel-header p {
    color: var(--muted);
    font-size: 14px;
}

.panel-header-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--primary-light);
    font-size: 27px;
}

/* ========================================
   ФУТБОЛЬНОЕ ТАБЛО
======================================== */

.scoreboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px minmax(0, 1fr);
    gap: 25px;

    align-items: center;

    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;

    padding: 30px;
    margin-bottom: 25px;
}

.team-side {
    min-width: 0;
}

.team-label,
.score-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-align: center;
    margin-bottom: 13px;
}

.team-input {
    width: 100%;
    height: 52px;

    padding: 0 15px;

    background: var(--input);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 10px;

    font-size: 15px;
    text-align: center;

    outline: none;
}

.team-input::placeholder {
    color: #64748b;
}

.team-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ========================================
   СЧЁТ
======================================== */

.score-center {
    text-align: center;
}

.score-inputs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.score-inputs input {
    width: 65px;
    height: 60px;

    background: var(--input);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 10px;

    text-align: center;
    font-size: 28px;
    font-weight: 800;

    outline: none;

    appearance: textfield;
    -moz-appearance: textfield;
}

.score-inputs input::-webkit-inner-spin-button,
.score-inputs input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.score-inputs input:focus {
    border-color: var(--primary);
}

.score-divider {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
}

/* ========================================
   АВТОПОДСКАЗКИ
======================================== */

.autocomplete-wrapper {
    position: relative;
}

.autocomplete-results {
    display: none;

    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;

    background: #1e2b42;
    border: 1px solid var(--border);
    border-radius: 10px;

    max-height: 240px;
    overflow-y: auto;

    z-index: 100;

    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
}

.autocomplete-item {
    padding: 13px 15px;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: var(--primary);
    color: #052e16;
}

/* ========================================
   НИЖНЯЯ ЧАСТЬ ФОРМЫ
======================================== */

.form-footer {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.date-field label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.date-field input {
    height: 48px;
    padding: 0 15px;

    background: var(--input);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 9px;

    outline: none;
    color-scheme: dark;
}

.date-field input:focus {
    border-color: var(--primary);
}

.save-btn {
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    padding: 0 25px;

    background: var(--primary);
    color: #052e16;

    border: none;
    border-radius: 9px;

    font-size: 14px;
    font-weight: 800;
}

.save-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.save-btn span {
    font-size: 22px;
    line-height: 1;
}

/* ========================================
   УВЕДОМЛЕНИЯ
======================================== */

.success-alert {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);

    color: #4ade80;

    padding: 14px 18px;
    border-radius: 9px;

    margin-bottom: 25px;
    font-size: 14px;
}

/* ========================================
   ИСТОРИЯ МАТЧЕЙ
======================================== */

.history-section {
    margin-top: 10px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 22px;
}

.history-header h2 {
    font-size: 24px;
    letter-spacing: -0.5px;
}

.history-count {
    background: var(--card);
    border: 1px solid var(--border);

    color: var(--muted);
    font-size: 12px;

    padding: 7px 13px;
    border-radius: 30px;
}

/* ========================================
   КАРТОЧКИ МАТЧЕЙ
======================================== */

.matches-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.match-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;

    padding: 18px 25px;

    display: grid;
    grid-template-columns: 145px 1fr;
    align-items: center;
    gap: 25px;

    transition:
        background 0.2s,
        border-color 0.2s;
}

.match-item:hover {
    background: var(--card-hover);
    border-color: #40516b;
}

.match-date {
    display: flex;
    align-items: center;
    gap: 9px;

    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.date-icon {
    font-size: 15px;
}

.match-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px minmax(0, 1fr);
    align-items: center;
    gap: 15px;
}

.match-team {
    font-size: 15px;
    font-weight: 700;
    min-width: 0;
    overflow-wrap: anywhere;
}

.match-team.home {
    text-align: right;
}

.match-team.away {
    text-align: left;
}

.match-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;

    padding: 9px 12px;

    font-size: 20px;
    font-weight: 800;
    white-space: nowrap;
}

.match-score-divider {
    color: var(--primary);
}

.no-score {
    color: var(--muted);
}

/* ========================================
   ПУСТАЯ ИСТОРИЯ
======================================== */

.empty-state {
    background: var(--card);
    border: 1px dashed var(--border);
    border-radius: 14px;

    text-align: center;
    padding: 55px 20px;
}

.empty-icon {
    font-size: 45px;
    margin-bottom: 15px;
}

.empty-state h3 {
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--muted);
    font-size: 14px;
}

/* ========================================
   ПОДВАЛ
======================================== */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 25px 24px;
}

.footer-inner {
    max-width: 1180px;
    margin: auto;

    display: flex;
    justify-content: space-between;

    color: var(--muted);
    font-size: 12px;
}

/* ========================================
   РЕГИСТРАЦИЯ И АВТОРИЗАЦИЯ
======================================== */

.auth-container {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;

    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;

    padding: 35px;
}

.auth-card h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 25px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 25px;
}

.auth-card label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

.auth-card input {
    width: 100%;
    padding: 13px;

    margin-bottom: 20px;

    background: var(--input);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 8px;

    outline: none;
}

.auth-card input:focus {
    border-color: var(--primary);
}

.auth-card button {
    width: 100%;
    padding: 14px;

    background: var(--primary);
    color: #052e16;

    border: none;
    border-radius: 8px;

    font-weight: 800;
}

.auth-card button:hover {
    background: var(--primary-hover);
}

.auth-card p {
    text-align: center;
    color: var(--muted);
    margin-top: 25px;
}

.auth-card a {
    color: var(--primary);
}

.alert {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;

    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* ========================================
   ПЛАНШЕТЫ
======================================== */

@media (max-width: 900px) {

    .scoreboard {
        grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr);
        gap: 15px;
        padding: 20px;
    }

    .score-inputs input {
        width: 53px;
    }

    .match-item {
        grid-template-columns: 115px 1fr;
        gap: 15px;
    }

}

/* ========================================
   ТЕЛЕФОНЫ
======================================== */

@media (max-width: 650px) {

    .header-inner {
        padding: 15px 18px;
    }

    .logo {
        font-size: 19px;
    }

    .main-nav {
        gap: 15px;
    }

    .nav-link {
        display: none;
    }

    .user-menu {
        gap: 12px;
        padding-left: 0;
        border: none;
    }

    .username {
        font-size: 12px;
    }

    .container {
        padding: 28px 16px 50px;
    }

    .welcome-section h1 {
        font-size: 25px;
    }

    .welcome-section p {
        font-size: 13px;
    }

    /* Статистика */

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-card:last-child {
        grid-column: 1 / -1;
    }

    .stat-number {
        font-size: 30px;
    }

    .stat-label {
        font-size: 11px;
    }

    /* Форма */

    .match-panel {
        padding: 20px;
    }

    .panel-header h2 {
        font-size: 21px;
    }

    .panel-header-icon {
        display: none;
    }

    /* Табло */

    .scoreboard {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 18px 12px;
        padding: 16px;
    }

    .team-side {
        min-width: 0;
    }

    .team-side:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }

    .team-side:nth-child(3) {
        grid-column: 2;
        grid-row: 1;
    }

    .score-center {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .team-input {
        height: 46px;
        font-size: 13px;
        padding: 0 8px;
    }

    .score-inputs input {
        width: 65px;
        height: 55px;
    }

    /* Дата и кнопка */

    .form-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .date-field input {
        width: 100%;
    }

    .save-btn {
        width: 100%;
    }

    /* История */

    .history-header h2 {
        font-size: 21px;
    }

    .match-item {
        display: block;
        padding: 17px;
    }

    .match-date {
        justify-content: center;
        margin-bottom: 15px;
        font-size: 12px;
    }

    .match-content {
        grid-template-columns: minmax(0, 1fr) 75px minmax(0, 1fr);
        gap: 8px;
    }

    .match-team {
        font-size: 12px;
    }

    .match-score {
        padding: 8px 5px;
        font-size: 17px;
        gap: 5px;
    }

    .footer-inner {
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }

}

/* Очень маленькие экраны */

@media (max-width: 360px) {

    .username {
        display: none;
    }

    .match-panel {
        padding: 15px;
    }

    .scoreboard {
        padding: 12px;
    }

    .team-input {
        font-size: 12px;
    }

}

/* ========================================
   ФИЛЬТРЫ ИСТОРИИ
======================================== */

.filters-form {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

.filter-group {
    min-width: 0;
}

.filter-group label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 9px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    height: 48px;
    padding: 0 14px;

    background: var(--input);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 9px;

    outline: none;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--primary);
}

.filter-group input::placeholder {
    color: #64748b;
}

.filter-actions {
    display: flex;
    gap: 10px;
}

.reset-btn {
    height: 48px;
    padding: 0 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--bg-secondary);
    color: var(--muted);

    border: 1px solid var(--border);
    border-radius: 9px;

    font-size: 13px;
    font-weight: 600;
}

.reset-btn:hover {
    color: var(--text);
    border-color: var(--primary);
}

/* ========================================
   ПАГИНАЦИЯ
======================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;

    margin-top: 30px;

    color: var(--muted);
    font-size: 13px;
}

.pagination a {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;

    padding: 10px 16px;

    color: var(--text);
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ========================================
   АДАПТИВНОСТЬ ФИЛЬТРОВ
======================================== */

@media (max-width: 900px) {

    .filters-form {
        grid-template-columns: 1fr 1fr;
    }

    .filter-actions {
        grid-column: 1 / -1;
    }

}

@media (max-width: 650px) {

    .filters-form {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        grid-column: auto;
    }

    .filter-actions .save-btn,
    .filter-actions .reset-btn {
        flex: 1;
    }

    .pagination {
        gap: 12px;
    }

}

/* ========================================
   УПРАВЛЕНИЕ МАТЧАМИ
======================================== */

.match-item:has(.match-actions) {
    grid-template-columns: 145px minmax(0, 1fr) 90px;
}

.match-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.match-actions form {
    margin: 0;
}

.match-action-btn {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;

    font-size: 15px;
    text-decoration: none;

    transition: 0.2s;
}

.edit-btn:hover {
    border-color: #eab308;
    background: rgba(234, 179, 8, 0.1);
}

.delete-btn:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.edit-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Планшеты */

@media (max-width: 900px) {

    .match-item:has(.match-actions) {
        grid-template-columns: 115px minmax(0, 1fr) 90px;
    }

}

/* Телефоны */

@media (max-width: 650px) {

    .match-item:has(.match-actions) {
        display: block;
    }

    .match-actions {
        justify-content: center;
        margin-top: 15px;
        padding-top: 12px;
        border-top: 1px solid var(--border);
    }

    .match-action-btn {
        width: 42px;
        height: 38px;
    }

    .edit-actions {
        flex-direction: column;
        width: 100%;
    }

    .edit-actions .save-btn,
    .edit-actions .reset-btn {
        width: 100%;
    }

}

/* ========================================
   СТАТИСТИКА
======================================== */

.stats-filters {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

.stats-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Графики */

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.chart-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 25px;
}

.chart-card h2 {
    font-size: 18px;
    margin-bottom: 25px;
}

.chart-container {
    position: relative;
    height: 260px;
}

/* Секции */

.statistics-section {
    margin-bottom: 40px;
}

/* Рейтинг */

.ranking-list {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.ranking-item {
    display: grid;
    grid-template-columns: 35px 220px 1fr 90px;
    gap: 15px;
    align-items: center;

    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item:hover {
    background: var(--card-hover);
}

.ranking-position {
    color: var(--primary);
    font-size: 16px;
    font-weight: 800;
}

.ranking-name {
    font-size: 14px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.ranking-bar-wrapper {
    height: 7px;
    background: var(--bg);
    border-radius: 10px;
    overflow: hidden;
}

.ranking-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
}

.ranking-views {
    text-align: right;
    font-size: 16px;
    font-weight: 800;
}

.ranking-views span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
}

/* Популярные пары */

.pairs-list {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.pair-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;

    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.pair-item:last-child {
    border-bottom: none;
}

.pair-item:hover {
    background: var(--card-hover);
}

.pair-teams {
    display: flex;
    align-items: center;
    gap: 15px;

    font-size: 14px;
    font-weight: 700;
}

.pair-vs {
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
}

.pair-count {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

/* Планшеты */

@media (max-width: 900px) {

    .stats-grid-four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .ranking-item {
        grid-template-columns: 30px 160px 1fr 80px;
    }

}

/* Телефоны */

@media (max-width: 650px) {

    .stats-filters {
        grid-template-columns: 1fr;
    }

    .stats-grid-four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ranking-item {
        grid-template-columns: 25px 1fr 65px;
        gap: 10px;
        padding: 14px;
    }

    .ranking-bar-wrapper {
        display: none;
    }

    .ranking-name {
        font-size: 12px;
    }

    .ranking-views {
        font-size: 14px;
    }

    .ranking-views span {
        display: none;
    }

    .pair-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .pair-teams {
        flex-wrap: wrap;
        gap: 8px;
    }

    .chart-card {
        padding: 18px;
    }

    .chart-container {
        height: 220px;
    }

}

/* Мобильная навигация */

@media (max-width: 650px) {

    .header-inner {
        flex-wrap: wrap;
        gap: 15px;
    }

    .main-nav {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 12px;
    }

    .main-nav .nav-link {
        display: inline-flex;
        font-size: 12px;
    }

    .user-menu {
        margin-left: auto;
    }

}

/* ========================================
   АДМИНИСТРАТИВНАЯ ПАНЕЛЬ
======================================== */

.admin-search {
    display: flex;
    gap: 12px;
}

.admin-search input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 15px;
    background: var(--input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
}

.admin-search input:focus {
    border-color: var(--primary);
}

.admin-teams-list {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.admin-team-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 25px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.admin-team-item:last-child {
    border-bottom: none;
}

.admin-team-item:hover {
    background: var(--card-hover);
}

.admin-team-info {
    min-width: 0;
    flex: 1;
}

.admin-team-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 5px;
}

.admin-team-meta {
    color: var(--muted);
    font-size: 12px;
}

.rename-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rename-form input {
    width: 230px;
    height: 42px;
    padding: 0 12px;
    background: var(--input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.rename-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.rename-form .save-btn {
    height: 42px;
}

.merge-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

@media (max-width: 900px) {

    .merge-form {
        grid-template-columns: 1fr 1fr;
    }

    .merge-form .save-btn {
        grid-column: 1 / -1;
    }

}

@media (max-width: 650px) {

    .admin-search {
        flex-wrap: wrap;
    }

    .admin-search input {
        flex-basis: 100%;
    }

    .admin-search .save-btn,
    .admin-search .reset-btn {
        flex: 1;
    }

    .admin-team-item {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 18px;
    }

    .rename-form input {
        width: 100%;
        min-width: 0;
    }

    .rename-form .save-btn {
        flex-shrink: 0;
    }

    .merge-form {
        grid-template-columns: 1fr;
    }

    .merge-form .save-btn {
        grid-column: auto;
    }

}

/* ========================================
   ПОХОЖИЕ КОМАНДЫ
======================================== */

.similar-item {
    background: rgba(234, 179, 8, 0.06);
    border-left: 3px solid #eab308;
}

.similar-label {
    display: block;
    font-size: 11px;
    color: #eab308;
    margin-bottom: 4px;
}

.similar-item strong {
    display: block;
    font-size: 14px;
}

.similar-item:hover .similar-label {
    color: #052e16;
}

/* ========================================
   ПОДТВЕРЖДЕНИЕ КОМАНД
======================================== */

.confirmation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.confirmation-team {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 25px;
}

.confirmation-team h3 {
    margin-bottom: 15px;
    font-size: 17px;
}

.confirmation-team p {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 15px;
}

.confirmation-team strong {
    color: var(--text);
}

.confirmation-team select {
    width: 100%;
    height: 48px;
    padding: 0 12px;
    background: var(--input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
}

.confirmation-team select:focus {
    border-color: var(--primary);
}

.confirmation-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

@media (max-width: 650px) {

    .confirmation-grid {
        grid-template-columns: 1fr;
    }

    .confirmation-team {
        padding: 18px;
    }

    .confirmation-actions {
        flex-direction: column;
    }

    .confirmation-actions .save-btn,
    .confirmation-actions .reset-btn {
        width: 100%;
    }

}

/* ========================================
   СТРАНИЦА ОШИБКИ
======================================== */

.error-container {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;
}

.error-card {
    width: 100%;
    max-width: 480px;

    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;

    padding: 45px 35px;

    text-align: center;
}

.error-icon {
    font-size: 50px;
    margin-bottom: 20px;
}

.error-card h1 {
    font-size: 23px;
    margin-bottom: 15px;
}

.error-card p {
    color: var(--muted);
    font-size: 15px;
    margin-bottom: 30px;
}

.error-card .save-btn {
    display: inline-flex;
    text-decoration: none;
}

/* ========================================
   ИНФОРМАЦИЯ НА СТРАНИЦЕ ПОДТВЕРЖДЕНИЯ
======================================== */

.confirmation-summary {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;

    padding: 20px 25px;
    margin-bottom: 25px;
}

.confirmation-summary-content {
    display: flex;
    align-items: center;
    gap: 30px;

    font-size: 14px;
    font-weight: 600;
}

.confirmation-team select {
    cursor: pointer;
}

.confirmation-team select:hover {
    border-color: var(--primary);
}

.confirmation-team strong {
    color: var(--text);
}

@media (max-width: 650px) {

    .confirmation-summary {
        padding: 18px;
    }

    .confirmation-summary-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

}

/* ========================================
   ПРОФИЛЬ ПОЛЬЗОВАТЕЛЯ
======================================== */

.profile-card {
    display: flex;
    align-items: center;
    gap: 25px;

    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;

    padding: 30px;
    margin-bottom: 25px;
}

.profile-avatar {
    width: 75px;
    height: 75px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--primary-light);
    color: var(--primary);

    border: 2px solid var(--primary);
    border-radius: 50%;

    font-size: 30px;
    font-weight: 800;
}

.profile-info h2 {
    font-size: 23px;
    margin-bottom: 6px;
}

.profile-info p {
    color: var(--muted);
    font-size: 13px;
}

.password-form {
    max-width: 500px;

    display: flex;
    flex-direction: column;
    gap: 20px;
}

.password-form .save-btn {
    align-self: flex-start;
}

.profile-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);

    color: #f87171;

    padding: 14px 18px;
    border-radius: 9px;

    margin-bottom: 25px;
    font-size: 14px;
}

.export-btn {
    display: inline-flex;
    width: fit-content;
    text-decoration: none;
}

@media (max-width: 650px) {

    .profile-card {
        padding: 20px;
        gap: 18px;
    }

    .profile-avatar {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .profile-info h2 {
        font-size: 19px;
    }

    .password-form .save-btn {
        width: 100%;
    }

    .export-btn {
        width: 100%;
    }

}

/* ========================================
   СТРАНИЦА КОМАНДЫ
======================================== */

/* Ссылки на команды */

.team-link {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.team-link:hover {
    color: var(--primary);
}

/* Фильтр года */

.team-filter-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;

    padding: 20px 25px;
    margin-bottom: 30px;
}

.team-filter-panel form {
    display: flex;
    align-items: flex-end;
    gap: 15px;
}

.team-filter-panel .filter-group {
    min-width: 200px;
}

/* Голы */

.team-goals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.team-goals-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
}

.team-goals-number {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 5px;
}

.team-goals-number.green {
    color: #22c55e;
}

.team-goals-number.red {
    color: #ef4444;
}

.team-goals-label {
    color: var(--muted);
    font-size: 13px;
}

/* Проценты результатов */

.team-results-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
}

.team-results-bar {
    display: flex;
    width: 100%;
    height: 16px;
    background: var(--bg);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 20px;
}

.results-win {
    background: #22c55e;
}

.results-draw {
    background: #eab308;
}

.results-loss {
    background: #ef4444;
}

.team-results-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    font-size: 13px;
    color: var(--muted);
}

/* Просмотры по годам */

.team-years-list {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.team-year-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 25px;
    border-bottom: 1px solid var(--border);
}

.team-year-item:last-child {
    border-bottom: none;
}

.team-year-item strong {
    color: var(--primary);
}

/* Адаптивность */

@media (max-width: 650px) {

    .team-filter-panel form {
        flex-direction: column;
        align-items: stretch;
    }

    .team-filter-panel .filter-group {
        min-width: 0;
    }

    .team-filter-panel .save-btn {
        width: 100%;
    }

    .team-goals-grid {
        gap: 12px;
    }

    .team-goals-card {
        padding: 20px;
    }

    .team-goals-number {
        font-size: 32px;
    }

    .team-results-card {
        padding: 20px;
    }

    .team-results-legend {
        flex-direction: column;
        gap: 10px;
    }

}

/* ========================================
   ПРОТИВОСТОЯНИЯ КОМАНД
======================================== */

/* Список соперников */

.opponents-list {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.opponents-header,
.opponent-item {
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(4, minmax(55px, 1fr));
    gap: 15px;
    align-items: center;
    padding: 15px 22px;
}

.opponents-header {
    background: var(--bg-secondary);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

.opponent-item {
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background 0.2s;
}

.opponent-item:last-child {
    border-bottom: none;
}

.opponent-item:hover {
    background: var(--card-hover);
}

.opponent-name {
    font-weight: 700;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.opponent-matches {
    color: var(--text);
    font-weight: 800;
}

.opponent-win {
    color: #22c55e;
}

.opponent-draw {
    color: #eab308;
}

.opponent-loss {
    color: #ef4444;
}

/* Табло противостояния */

.h2h-scoreboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 80px minmax(0, 1fr);
    align-items: center;
    gap: 20px;

    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;

    padding: 45px 30px;
    margin-bottom: 25px;
}

.h2h-team {
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.h2h-team a:hover {
    color: var(--primary);
}

.h2h-vs {
    text-align: center;
    color: var(--primary);
    font-size: 24px;
    font-weight: 900;
}

/* Голы */

.h2h-goals {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.h2h-goals-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
    text-align: center;
}

.h2h-goals-card h3 {
    font-size: 16px;
    margin-bottom: 15px;
}

.h2h-goals-number {
    color: var(--primary);
    font-size: 42px;
    font-weight: 800;
}

/* Адаптивность */

@media (max-width: 650px) {

    .opponents-header,
    .opponent-item {
        grid-template-columns: minmax(0, 1.5fr) repeat(4, minmax(30px, 1fr));
        gap: 6px;
        padding: 13px 10px;
        text-align: center;
    }

    .opponents-header {
        font-size: 9px;
    }

    .opponent-name {
        text-align: left;
        font-size: 11px;
    }

    .opponent-item {
        font-size: 12px;
    }

    .h2h-scoreboard {
        grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
        gap: 8px;
        padding: 30px 12px;
    }

    .h2h-team {
        font-size: 15px;
    }

    .h2h-vs {
        font-size: 17px;
    }

    .h2h-goals {
        gap: 12px;
    }

    .h2h-goals-card {
        padding: 18px 12px;
    }

    .h2h-goals-card h3 {
        font-size: 12px;
    }

    .h2h-goals-number {
        font-size: 32px;
    }

}

/* ========================================
   КАЛЕНДАРЬ MATCHDIARY
======================================== */

.calendar-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
}

.calendar-months {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px;
}

.calendar-month {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    min-width: 0;
}

.calendar-month h3 {
    font-size: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.calendar-weekdays,
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.calendar-weekdays {
    margin-bottom: 8px;
}

.calendar-weekdays span {
    text-align: center;
    color: var(--muted);
    font-size: 11px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    transition: 0.2s;
}

.calendar-day.level-0 {
    background: #202d42;
    color: #64748b;
}

.calendar-day.level-1 {
    background: #14532d;
    color: #bbf7d0;
}

.calendar-day.level-2 {
    background: #15803d;
    color: white;
}

.calendar-day.level-3 {
    background: #22c55e;
    color: #052e16;
}

a.calendar-day:hover {
    transform: scale(1.12);
    outline: 2px solid white;
    z-index: 2;
}

.calendar-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    margin-top: 30px;
    color: var(--muted);
    font-size: 12px;
}

.legend-box {
    width: 17px;
    height: 17px;
    border-radius: 4px;
}

.legend-box.level-0 {
    background: #202d42;
}

.legend-box.level-1 {
    background: #14532d;
}

.legend-box.level-2 {
    background: #15803d;
}

.legend-box.level-3 {
    background: #22c55e;
}

.calendar-back {
    margin-top: 30px;
}

.calendar-back .reset-btn {
    display: inline-flex;
}

/* Планшеты */

@media (max-width: 900px) {

    .calendar-months {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

/* Телефоны */

@media (max-width: 650px) {

    .calendar-panel {
        padding: 18px;
    }

    .calendar-months {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .calendar-month {
        padding: 18px;
    }

    .calendar-day {
        font-size: 12px;
    }

}

/* Подвал сайта */

.site-footer {
    margin-top: 50px;
    padding: 24px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #8b949e;
    font-size: 13px;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

@media (max-width: 600px) {
    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

/* ==============================
   Records page
   ============================== */

.records-page {
    width: min(1200px, calc(100% - 32px));
    margin: 32px auto 0;
}

.records-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 28px;
    padding: 28px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 22px;
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.18), transparent 34%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.78));
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.records-hero h1 {
    margin: 4px 0 10px;
    color: #f8fafc;
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1.05;
}

.records-hero-text {
    max-width: 720px;
    margin: 0;
    color: #94a3b8;
    font-size: 15px;
    line-height: 1.7;
}

.records-hero-link,
.record-link,
.primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: 0.18s ease;
}

.records-hero-link:hover,
.record-link:hover,
.primary-action:hover {
    background: rgba(34, 197, 94, 0.22);
    border-color: rgba(34, 197, 94, 0.8);
    color: #dcfce7;
    transform: translateY(-1px);
}

.records-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.records-summary-card {
    padding: 20px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.78);
}

.records-summary-label {
    display: block;
    margin-bottom: 10px;
    color: #22c55e;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.records-summary-card strong {
    display: block;
    color: #f8fafc;
    font-size: 34px;
    line-height: 1;
}

.records-summary-card small {
    display: block;
    margin-top: 8px;
    color: #94a3b8;
    font-size: 13px;
}

.records-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.record-card {
    min-height: 235px;
    padding: 22px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.84), rgba(15, 23, 42, 0.92));
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
}

.record-card-large {
    grid-column: span 2;
}

.record-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.record-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.12);
    font-size: 18px;
}

.record-label {
    color: #22c55e;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.record-value {
    margin-bottom: 10px;
    color: #f8fafc;
    font-size: clamp(34px, 5vw, 56px);
    font-weight: 900;
    line-height: 1;
}

.record-title {
    margin: 0 0 8px;
    color: #e5e7eb;
    font-size: 20px;
    line-height: 1.35;
}

.record-meta {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.6;
}

.record-link {
    margin-top: 18px;
    min-height: 36px;
    padding: 8px 13px;
    font-size: 13px;
}

.records-details-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 18px;
}

.records-panel {
    padding: 24px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 22px;
    background: rgba(15, 23, 42, 0.82);
}

.records-panel h2 {
    margin: 4px 0 18px;
    color: #f8fafc;
    font-size: 22px;
}

.records-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.weekday-list {
    display: grid;
    gap: 13px;
}

.weekday-row {
    display: grid;
    grid-template-columns: 115px 1fr 42px;
    align-items: center;
    gap: 12px;
}

.weekday-name {
    color: #cbd5e1;
    font-size: 14px;
}

.weekday-bar-wrap {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
}

.weekday-bar {
    height: 100%;
    min-width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #16a34a, #22c55e);
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.32);
}

.weekday-count {
    color: #f8fafc;
    font-weight: 800;
    text-align: right;
}

.timeline-facts {
    display: grid;
    gap: 14px;
}

.timeline-fact {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.timeline-fact:last-child {
    border-bottom: 0;
}

.timeline-fact span {
    color: #94a3b8;
    font-size: 14px;
}

.timeline-fact strong {
    color: #f8fafc;
    text-align: right;
}

.records-empty {
    max-width: 680px;
    margin: 60px auto;
    padding: 40px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.82);
    text-align: center;
}

.records-empty-icon {
    margin-bottom: 12px;
    font-size: 46px;
}

.records-empty h2 {
    margin: 0 0 10px;
    color: #f8fafc;
    font-size: 28px;
}

.records-empty p {
    max-width: 480px;
    margin: 0 auto 22px;
    color: #94a3b8;
    line-height: 1.7;
}

@media (max-width: 1000px) {
    .records-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .records-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .record-card-large {
        grid-column: span 2;
    }

    .records-details-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .records-page {
        width: min(100% - 22px, 1200px);
        margin-top: 22px;
    }

    .records-hero {
        flex-direction: column;
        padding: 22px;
    }

    .records-summary-grid,
    .records-grid {
        grid-template-columns: 1fr;
    }

    .record-card-large {
        grid-column: span 1;
    }

    .weekday-row {
        grid-template-columns: 1fr 42px;
        gap: 8px;
    }

    .weekday-name {
        grid-column: 1 / -1;
    }

    .timeline-fact {
        flex-direction: column;
        gap: 6px;
    }

    .timeline-fact strong {
        text-align: left;
    }
}