/* ==================================================================
   Модальное окно входа/регистрации (промпт 19, задачи A/B/F)
   Подключается: <link rel="stylesheet" href="/static/css/login.css">
   и <script src="/static/js/login.js"></script> перед </body>.
   ================================================================== */
.csg-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 24px 12px;
}
.csg-modal-overlay.show { display: flex; }
.csg-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 440px;
    padding: 24px 28px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}
.csg-modal.wide { max-width: 520px; }
.csg-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.csg-modal-head h2 { font-size: 1.15rem; color: #2c3e50; margin: 0; }
.csg-modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: #7f8c8d;
    cursor: pointer;
}
.csg-logo { display: block; margin: 0 auto 8px; width: 56px; height: 56px; object-fit: contain; }
.csg-field { margin-bottom: 12px; }
.csg-field label { display: block; font-size: 0.85rem; margin-bottom: 4px; color: #34495e; }
.csg-field input,
.csg-field select {
    width: 100%;
    padding: 10px;
    border: 1px solid #d5dde5;
    border-radius: 6px;
    font-size: 0.95rem;
    box-sizing: border-box;
}
.csg-field input:focus { outline: 2px solid #3498db; }
.csg-field-row { display: flex; gap: 8px; align-items: flex-end; }
.csg-field-row .csg-grow { flex: 1; }
.csg-error { color: #d9534f; background: #fdecea; border: 1px solid #f5c6cb; border-radius: 6px; padding: 8px 10px; font-size: 0.9rem; margin-bottom: 12px; display: none; }
.csg-error.show { display: block; }
.csg-msg { color: #27ae60; background: #eafaf1; border: 1px solid #b7ebd0; border-radius: 6px; padding: 8px 10px; font-size: 0.9rem; margin-bottom: 12px; display: none; }
.csg-msg.show { display: block; }
.csg-row-btns { display: flex; gap: 10px; margin-top: 6px; }
.csg-btn {
    flex: 1;
    padding: 11px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
}
.csg-btn.primary { background: #2c3e50; color: #fff; }
.csg-btn.primary:hover { background: #34495e; }
.csg-btn.secondary { background: #ecf0f1; color: #333; }
.csg-btn.secondary:hover { background: #dfe4e6; }
.csg-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.csg-pd { font-size: 0.8rem; color: #7f8c8d; margin: 10px 0; }
.csg-pd a { color: #3498db; }
/* Подсветка незаполненного согласия ПД при запросе кода (красным) */
.csg-pd.cs-pd-error { color: #c0392b; font-weight: 600; }
.csg-pd.cs-pd-error a { color: #c0392b; }
.csg-pd.cs-pd-error input { outline: 2px solid #e74c3c; outline-offset: 2px; }
.csg-verify-note { font-size: 0.8rem; color: #7f8c8d; margin-top: 4px; }
.csg-code-input { letter-spacing: 8px; font-size: 1.2rem; text-align: center; font-weight: 600; }
/* Подсветка кода подтверждения: верный (зелёный) / неверный (красный) */
.csg-code-input.cs-code-ok { border-color: #27ae60; background: #eafaf1; color: #166534; }
.csg-code-input.cs-code-bad { border-color: #e74c3c; background: #fdecea; color: #b91c1c; }

/* ==================================================================
   Промпт 21: живая проверка занятости email/ник/телефон при регистрации.
   ================================================================== */
.csg-field-error { display: none; font-size: 0.8rem; color: #c0392b; margin-top: 4px; }
.csg-field-error.show { display: block; }
.csg-input-taken,
.csg-input-taken:focus {
    border-color: #c0392b !important;
    background: #fff5f5 !important;
    outline-color: #c0392b !important;
}

/* ==================================================================
   Настройка аккаунта: инлайн-панель под #admin-content и модалка.
   Классы (вместо inline style) — CSP style-src 'self' запрещает
   style-атрибуты на странице админки.
   ================================================================== */
.csg-btn.danger { background: #c0392b; color: #fff; }
.csg-btn.danger:hover { background: #a93226; }
.acct-panel { background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.1);
    padding: 20px 24px; max-width: 960px; }
.acct-panel .acct-head { display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.acct-panel .acct-head h1 { font-size: 20px; margin: 0; display: flex; align-items: center; gap: 8px; }
.acct-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.acct-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.acct-field label { font-size: 12px; color: #64748b; }
.acct-field input { padding: 7px 9px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 14px; box-sizing: border-box; width: 100%; }
.acct-field input:disabled { background: #f1f5f9; color: #64748b; }
.acct-field.acct-full, .acct-pass-box { grid-column: 1 / -1; }
.acct-pass-box { border-top: 1px solid #e2e8f0; padding-top: 12px; }
.acct-email-ok { border: 1px solid #2e7d32 !important; background: #f2fff2; }
.acct-email-bad { border: 1px solid #c0392b !important; background: #fff5f5; }
.acct-label-bad { color: #c0392b; font-weight: 700; }
.acct-actions { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.acct-actions .csg-btn { flex: 0 0 auto; padding: 9px 14px; }
.acct-resend { flex: 0 0 auto !important; padding: 7px 14px !important; }
.acct-message { margin: 10px 0; padding: 8px 12px; border-radius: 6px; font-size: .9rem; display: none; }
.acct-message.show { display: block; }
.acct-message.ok { background: #dcfce7; color: #166534; }
.acct-message.error { background: #fee2e2; color: #b91c1c; }
.acct-hidden { display: none !important; }
.acct-email-row { display: flex; gap: 6px; align-items: flex-start; }
.acct-email-row .acct-field { flex: 1; }

/* --- Чекбокс «Сохранять фильтры при выходе» --- */
.acct-opt.checkbox,
.csg-field .acct-opt.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #2c3e50;
    cursor: pointer;
    margin: 6px 0 2px;
}
.acct-opt.checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #3498db;
    flex: 0 0 auto;
}
.acct-full-col { grid-column: 1 / -1; }
.acct-hint {
    font-size: 0.78rem;
    color: #7f8c8d;
    margin: 2px 0 0 24px;
    line-height: 1.35;
}
.acct-field .acct-hint {
    margin-left: 0;
    margin-top: 4px;
}

/* ==================================================================
   Блок «Донаты» в настройках аккаунта (только владелец).
   ================================================================== */
.donate-settings {
    grid-column: 1 / -1;
    border: 1px solid #e8edf2;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 10px 0 4px;
    background: #fdfbf7;
}
.donate-settings-title {
    font-size: 1rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 6px;
}
.donate-settings .ds-hint {
    margin-left: 0;
}
.donate-settings .acct-opt.checkbox {
    margin-top: 8px;
}
.donate-settings .ds-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    margin-top: 12px;
}
.donate-settings .ds-field > label,
.donate-settings .ds-field .ds-sublabel {
    font-size: 0.82rem;
    color: #64748b;
    margin-bottom: 2px;
}
.donate-settings .ds-field .ds-sublabel {
    margin-top: 8px;
}
.donate-settings .ds-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 16px;
    margin-top: 4px;
}
.donate-settings input[type="text"],
.donate-settings input[type="url"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
    background: #fff;
}
.donate-settings textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.45;
    box-sizing: border-box;
    font-family: inherit;
    resize: vertical;
    background: #fff;
}
.donate-settings input[type="file"] {
    font-size: 0.85rem;
}
.ds-qr-preview-wrap {
    display: none;
    margin-top: 6px;
}
.ds-qr-preview-wrap.show {
    display: block;
}
.ds-qr-preview-wrap img {
    max-width: 140px;
    max-height: 140px;
    border: 1px solid #e8edf2;
    border-radius: 8px;
    background: #fff;
    padding: 4px;
}
@media (max-width: 900px) {
    .donate-settings .ds-grid {
        grid-template-columns: 1fr;
    }
}
