:root { 
    --bg-dark: #0b132b; 
    --bg-card: #141f3d; 
    --accent: #f59e0b; 
    --text-main: #ffffff; 
    --border-color: #1e293b; 
}
body { font-family: 'Segoe UI', sans-serif; background-color: var(--bg-dark); color: var(--text-main); margin: 0; padding: 20px; }

.header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 20px; margin-bottom: 20px; flex-wrap: wrap; gap: 15px;}
h1, h2, h3 { margin: 0; }
.grid { display: grid; grid-template-columns: 1fr 2fr; gap: 30px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

/* Вкладки Рабочих Пространств */
.top-tabs-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 12px;
    margin-bottom: 25px;
    overflow: visible;
    border: 1px solid var(--border-color);
}
.top-tab-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.top-tab-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.05); }
.top-tab-btn.active { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border-color: #3b82f6; }
.top-tab-btn.beach-tab.active { background: rgba(16, 185, 129, 0.15); color: #10b981; border-color: #10b981; }

.workspace-section { display: none; animation: fadeIn 0.3s ease; }
.workspace-section.active { display: block; }

/* Обычные карточки */
.card { background: var(--bg-card); padding: 25px; border-radius: 12px; border: 1px solid var(--border-color); margin-bottom: 30px; }
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; color: #94a3b8; font-size: 0.9rem; }
input[type="text"], input[type="number"], input[type="time"], input[type="date"], select { width: 100%; padding: 10px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); color: white; border-radius: 6px; box-sizing: border-box; }
input[type="checkbox"] { width: auto; transform: scale(1.2); cursor: pointer; }

input[type="color"] { width: 100%; height: 40px; padding: 0; border: none; border-radius: 6px; cursor: pointer; background: transparent; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid var(--border-color); border-radius: 6px; }

input[type="file"] { width: 100%; color: #94a3b8; font-size: 0.85rem; }

button { background: var(--accent); color: #000; border: none; padding: 10px 20px; border-radius: 6px; font-weight: bold; cursor: pointer; transition: 0.2s; width: 100%; }
button:hover { opacity: 0.8; }
.btn-danger { background: #ef4444; color: white; width: auto; padding: 5px 10px; font-size: 0.8rem; }
.btn-action { background: #3b82f6; color: white; width: auto; padding: 5px 10px; font-size: 0.8rem; }
.btn-edit { background: #10b981; color: white; width: auto; padding: 5px 10px; font-size: 0.8rem; }
.btn-neutral { background: #444; color: white; }
.btn-super { background: transparent; border: 1px solid #10b981; color: #10b981; width: auto; padding: 5px 10px; font-size: 0.8rem; }
.btn-super:hover { background: #10b981; color: white; }

table { width: 100%; border-collapse: collapse; margin-top: 15px; min-width: 600px; }
.table-responsive { overflow-x: auto; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { color: #94a3b8; font-size: 0.85rem; text-transform: uppercase; }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); align-items: center; justify-content: center; z-index: 1000;}
.modal.active { display: flex; }
.modal-content { background: var(--bg-card); padding: 30px; border-radius: 12px; width: 700px; max-width: 95%; max-height: 90vh; overflow-y: auto;}
.close-btn { float: right; cursor: pointer; font-size: 1.5rem; color: #94a3b8; line-height: 1; border: none; background: none; }
.close-btn:hover { color: white; }

#authScreen { display: flex; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-dark); z-index: 9999; flex-direction: column; align-items: center; justify-content: center; }
.auth-box { background: var(--bg-card); padding: 40px; border-radius: 16px; border: 1px solid var(--border-color); width: 320px; display: flex; flex-direction: column; gap: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }

.team-visuals { display: flex; align-items: center; gap: 10px; }
.color-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid #fff; flex-shrink: 0; }
.jersey-img { width: 25px; height: 25px; border-radius: 4px; object-fit: cover; background: #222; }
.libero-img { border: 2px solid var(--accent); }

/* Вкладки для пляжки (База) */
.beach-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; flex-wrap: wrap;}
.beach-tab-btn { background: transparent; color: var(--text-muted); border: none; padding: 10px 20px; cursor: pointer; font-weight: bold; width: auto; border-radius: 6px; }
.beach-tab-btn.active { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.beach-tab-btn:hover { color: var(--text-main); }
.beach-section { display: none; animation: fadeIn 0.3s; }
.beach-section.active { display: block; }
@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }

.mult-rule { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; }

/* 🛡️ Статусы модерации игроков (Новое) */
.role-badge {
    font-size: 0.75rem;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}
.badge-pending { 
    background: rgba(245, 158, 11, 0.1) !important; 
    color: #f59e0b !important; 
    border: 1px solid rgba(245, 158, 11, 0.3); 
    padding: 2px 6px; 
    border-radius: 4px; 
    font-size: 0.75rem; 
}
.badge-approved { 
    background: rgba(16, 185, 129, 0.1) !important; 
    color: #10b981 !important; 
    border: 1px solid rgba(16, 185, 129, 0.3); 
    padding: 2px 6px; 
    border-radius: 4px; 
    font-size: 0.75rem; 
}
/* =========================================================
   ПЛЯЖНЫЙ ЭТАП — ДЕСКТОПНЫЙ LAYOUT
   ========================================================= */

#workspace-beach {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.beach-workspace-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.beach-workspace-stack > .card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 0;
    padding: 18px;
    box-sizing: border-box;
}

/* Формы не выходят за карточку */
#workspace-beach .card > div[style*="display: flex"] {
    flex-wrap: wrap;
    min-width: 0;
}

/* Только таблица может прокручиваться внутри карточки */
#workspace-beach .table-responsive {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: auto;
}

/* Таблицы */
#workspace-beach table {
    width: 100%;
    max-width: none;
    table-layout: auto;
}

#workspace-beach th,
#workspace-beach td {
    padding: 8px 9px;
    font-size: 0.84rem;
}

/* Компактные поля */
#workspace-beach select,
#workspace-beach input {
    max-width: 100%;
    min-width: 0;
    padding: 7px;
    font-size: 0.84rem;
}

#workspace-beach button {
    padding: 7px 11px;
    flex-shrink: 0;
}

/* Время и площадка в расписании */
#beachScheduleTableBody .time-input {
    width: 78px !important;
}

#beachScheduleTableBody td:nth-child(2) input {
    width: 42px !important;
}

/* Турнирная таблица всегда ниже расписания */
#beachGroupStandingsContainer {
    display: block;
    position: relative;
    clear: both;
    width: 100%;
    max-width: 100%;
    margin-top: 30px;
}
/* =========================================================
   ПОИСК ИГРОКОВ
   ========================================================= */

.player-autocomplete {
    position: relative;
}

.player-autocomplete-list {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    z-index: 5000;
    max-height: 340px;
    overflow-y: auto;
    background: #111b35;
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.55);
}

.player-autocomplete-list.active {
    display: block;
}

.player-autocomplete-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 11px 13px;
    border: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.13);
    border-radius: 0;
    background: transparent;
    color: white;
    text-align: left;
}

.player-autocomplete-item:last-child {
    border-bottom: 0;
}

.player-autocomplete-item:hover {
    background: rgba(59, 130, 246, 0.18);
    opacity: 1;
}

.player-autocomplete-name {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
}

.player-autocomplete-meta {
    margin-top: 3px;
    color: #94a3b8;
    font-size: 0.76rem;
    font-weight: 400;
    line-height: 1.3;
}

.player-autocomplete-empty {
    padding: 13px;
    color: #94a3b8;
    font-size: 0.82rem;
}
/* =========================================================
   PLAYER SEARCH PRO V2
   ========================================================= */

.player-search-status {
    min-height: 18px;
    margin-top: 5px;
    font-size: 0.75rem;
    line-height: 1.25;
}

.player-search-status.found {
    color: #f59e0b;
}

.player-search-status.new {
    color: #60a5fa;
}

.player-search-status.selected {
    color: #10b981;
}

.player-autocomplete-section-title {
    padding: 9px 13px;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(148, 163, 184, 0.13);
}

.player-autocomplete-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.player-autocomplete-item.active {
    background: rgba(59, 130, 246, 0.22);
    box-shadow: inset 3px 0 0 #3b82f6;
}

.player-autocomplete-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    color: #f59e0b;
}

.player-autocomplete-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.player-search-highlight {
    padding: 0;
    background: rgba(245, 158, 11, 0.28);
    color: #fbbf24;
    border-radius: 2px;
}

.player-autocomplete-empty {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.player-autocomplete-empty strong {
    color: #e2e8f0;
}

.player-autocomplete-empty span {
    color: #94a3b8;
}
/* Фото и защита от повторного выбора игрока */

.player-autocomplete-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: #1e293b;
    border: 1px solid #475569;
}

.player-avatar-placeholder,
.player-recent-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.player-autocomplete-item.disabled {
    cursor: not-allowed;
    opacity: 0.48;
    background: rgba(255, 255, 255, 0.025);
}

.player-autocomplete-item.disabled:hover {
    opacity: 0.48;
    background: rgba(255, 255, 255, 0.025);
}

.player-autocomplete-disabled-label {
    margin-left: auto;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.13);
    color: #f87171;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
}

.player-search-status.duplicate {
    color: #f87171;
}