/* Страница настроек — те же токены, что на index.html */
:root {
    --bg0: #0c0f0e;
    --bg1: #141a18;
    --panel: #1a2220;
    --stroke: rgba(212, 175, 55, 0.22);
    --gold: #d4af37;
    --mint: #6ee7b7;
    --text: #e8ebe9;
    --muted: #8b9a94;
    --danger: #f87171;
    --radius: 16px;
}

.settings-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--stroke);
    background: rgba(26, 34, 32, 0.55);
    backdrop-filter: blur(8px);
}
.settings-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
}
.settings-nav a {
    color: var(--mint);
    text-decoration: none;
}
.settings-nav a:hover {
    text-decoration: underline;
}
.settings-nav-sep {
    color: var(--muted);
    opacity: 0.7;
}
.settings-top-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    max-width: min(100%, 720px);
}
.pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    border: 1px solid var(--stroke);
    color: var(--muted);
}
.pill.ok {
    border-color: rgba(110, 231, 183, 0.45);
    color: var(--mint);
}
.pill.warn {
    color: rgba(248, 250, 252, 0.88);
}

.btn {
    font-family: inherit;
    cursor: pointer;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
}
.btn-tiny {
    padding: 8px 12px;
    font-size: 0.82rem;
}
.btn-primary {
    background: linear-gradient(135deg, #9a7b2c, var(--gold));
    color: #1a1206;
}
.btn-ghost {
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--stroke);
}

.settings-panel {
    width: min(920px, 96vw);
    max-width: 96vw;
    margin: 24px auto 48px;
    padding: 24px;
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    box-sizing: border-box;
}

#settingsPage h3 {
    margin: 0 0 16px;
    font-family: 'Fraunces', Georgia, serif;
    color: var(--gold);
}
.hint {
    font-size: 0.86rem;
    color: var(--muted);
    line-height: 1.45;
}
.lbl {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.95);
}

#settingsPage input[type="text"]:not(.ls-key-input),
#settingsPage input[type="url"],
#settingsPage input[type="password"]:not(.ls-key-input),
#settingsPage select,
#settingsPage textarea {
    width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.32);
    background: linear-gradient(180deg, rgba(24, 32, 29, 0.95), rgba(12, 16, 14, 0.98));
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#settingsPage input:not(.ls-key-input):focus,
#settingsPage select:focus,
#settingsPage textarea:focus {
    outline: none;
    border-color: rgba(110, 231, 183, 0.5);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(110, 231, 183, 0.12);
}
#settingsPage .lbl {
    margin-top: 14px;
}

.ls-settings-flash {
    display: none;
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.5);
    color: #bbf7d0;
    box-shadow: 0 0 28px rgba(34, 197, 94, 0.15);
}
.ls-settings-flash.visible {
    display: block;
    animation: lsSettingsFlashIn 0.35s ease;
}
@keyframes lsSettingsFlashIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-del-key {
    border-color: rgba(248, 113, 113, 0.45) !important;
    color: #fecaca !important;
}
.btn-del-key:hover {
    background: rgba(248, 113, 113, 0.12) !important;
}

.ls-key-saved-tag {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--mint);
    margin-left: 8px;
    letter-spacing: 0.02em;
}
.ls-key-wrap {
    display: flex;
    align-items: stretch;
    margin-top: 6px;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.22);
    background: rgba(12, 15, 14, 0.88);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ls-key-wrap--saved {
    border-color: rgba(110, 231, 183, 0.55);
    box-shadow: 0 0 0 1px rgba(110, 231, 183, 0.14), inset 0 1px 0 rgba(110, 231, 183, 0.06);
    background: rgba(16, 28, 24, 0.92);
}
.ls-key-wrap .ls-key-input {
    flex: 1;
    min-width: 0;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.ls-key-wrap .ls-key-input:focus {
    box-shadow: none !important;
}
.ls-key-eye {
    flex-shrink: 0;
    width: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-left: 1px solid rgba(212, 175, 55, 0.15);
    background: rgba(20, 26, 24, 0.95);
    color: var(--muted);
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
}
.ls-key-wrap--saved .ls-key-eye {
    border-left-color: rgba(110, 231, 183, 0.25);
    background: rgba(14, 32, 26, 0.88);
}
.ls-key-eye:hover {
    background: rgba(110, 231, 183, 0.12);
    color: var(--mint);
}
.ls-key-eye[hidden] {
    display: none !important;
}

.ls-int-card {
    margin-top: 20px;
    padding: 16px 14px;
    border-radius: 14px;
    border: 1px dashed rgba(212, 175, 55, 0.28);
    background: rgba(12, 15, 14, 0.55);
}
.ls-int-card h4 {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ls-int-card .ls-int-desc {
    font-size: 0.86rem;
    color: var(--muted);
    margin: 0 0 12px;
    line-height: 1.45;
}
.ls-int-repeater {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}
.ls-int-row {
    display: grid;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    background: linear-gradient(165deg, rgba(18, 24, 22, 0.9), rgba(12, 16, 14, 0.92));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.ls-od-pair {
    margin-top: 16px;
    padding: 14px 14px 12px;
    border-radius: 14px;
    border: 1px solid rgba(110, 231, 183, 0.22);
    background: rgba(8, 14, 12, 0.55);
}
.ls-od-pair .lbl:first-of-type {
    margin-top: 0;
}
.ls-int-row input,
.ls-int-row textarea {
    width: 100%;
    margin: 0;
}
.ls-int-row .btn-del-row {
    width: 100%;
    margin-top: 4px;
    border-color: rgba(248, 113, 113, 0.45) !important;
    color: #fecaca !important;
    font-size: 0.88rem;
}
.btn-ls-add {
    width: 100%;
    margin-top: 4px;
    border: 1px dashed rgba(110, 231, 183, 0.35);
    background: transparent;
    color: var(--mint);
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
}
.btn-ls-add:hover {
    background: rgba(110, 231, 183, 0.08);
}
.btn-ls-save-big {
    width: 100%;
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #15803d, #22c55e);
    color: #f0fdf4;
}
.btn-ls-save-big:hover {
    filter: brightness(1.06);
}
.btn-ls-save-all {
    width: 100%;
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid rgba(212, 175, 55, 0.5);
    cursor: pointer;
    font-weight: 800;
    font-size: 0.98rem;
    background: linear-gradient(135deg, rgba(154, 123, 44, 0.95), rgba(212, 175, 55, 0.88));
    color: #1a1206;
    box-shadow: 0 4px 24px rgba(212, 175, 55, 0.18);
}
.btn-ls-save-all:hover {
    filter: brightness(1.05);
}
.btn-ls-save-od {
    width: 100%;
    margin-top: 10px;
    padding: 11px 16px;
    border-radius: 12px;
    border: 1px solid rgba(125, 211, 252, 0.45);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.92rem;
    background: rgba(14, 58, 78, 0.55);
    color: #bae6fd;
}
.btn-ls-save-od:hover {
    background: rgba(56, 189, 248, 0.15);
}

.ls-avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin: 10px 0;
    max-height: 420px;
    overflow-y: auto;
    padding: 4px;
}
@media (max-width: 700px) {
    .ls-avatar-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.ls-avatar-card {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
    position: relative;
}
.ls-avatar-card:hover {
    border-color: rgba(212, 175, 55, 0.45);
}
.ls-avatar-card.selected {
    border-color: #6ee7b7;
    box-shadow: 0 0 12px rgba(110, 231, 183, 0.25);
}
.ls-avatar-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: #1a2220;
}
.ls-avatar-card .ls-av-name {
    font-size: 0.65rem;
    padding: 3px 4px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ls-avatar-card.selected .ls-av-name {
    color: #6ee7b7;
    font-weight: 700;
}
.ls-avatar-search {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--stroke);
    background: rgba(12, 15, 14, 0.88);
    color: var(--text);
    margin-top: 8px;
    font-family: inherit;
}

/* Уведомление сверху блока: всегда заметно при прокрутке */
#settingsFlash.ls-settings-flash {
    position: sticky;
    top: 0;
    z-index: 35;
    margin-bottom: 14px;
}

/* Подтверждение рядом с кнопками вебхуков и блока ссылок шага 3 */
.ls-inline-save-status {
    min-height: 1.35em;
    margin-top: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--mint);
    letter-spacing: 0.01em;
}

/* Поля API-ключей: тёмный фон как у остальных полей (без «белых плашек» браузера) */
#settingsPage .ls-key-wrap .ls-key-input {
    background: linear-gradient(180deg, rgba(24, 32, 29, 0.98), rgba(12, 16, 14, 0.99)) !important;
    color: var(--text) !important;
    -webkit-text-fill-color: var(--text) !important;
}
#settingsPage input:-webkit-autofill,
#settingsPage input:-webkit-autofill:hover,
#settingsPage input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text) !important;
    caret-color: var(--text);
    transition: background-color 9999s ease-out 0s;
    box-shadow: inset 0 0 0 40px rgba(12, 15, 14, 0.98) !important;
}

/* Строки вебхуков — те же оттенки, что и у полей #settingsPage */
.ls-int-row .ls-wh-label,
.ls-int-row .ls-wh-url {
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(212, 175, 55, 0.28);
    background: linear-gradient(180deg, rgba(24, 32, 29, 0.95), rgba(12, 16, 14, 0.98));
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.ls-int-row .ls-wh-label:focus,
.ls-int-row .ls-wh-url:focus {
    outline: none;
    border-color: rgba(110, 231, 183, 0.45);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 0 2px rgba(110, 231, 183, 0.12);
}
