/* ── Settings modal w/search ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.8); display: none; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(4px); }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 16px; width: 90%; max-width: 800px; max-height: 80vh; display: flex; overflow: hidden; }
.modal-sidebar { width: 200px; background: var(--bg-tertiary); border-right: 1px solid var(--border-color); padding: 16px; }
.modal-nav-item { padding: 10px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; transition: all 0.2s; }
.modal-nav-item:hover, .modal-nav-item.active { background: var(--bg-hover); color: var(--text-primary); }
.modal-content { flex: 1; padding: 24px; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title  { font-size: 20px; font-weight: 600; }
.modal-close  { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: transparent; border: none; color: var(--text-secondary); cursor: pointer; border-radius: 6px; }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.setting-group { margin-bottom: 24px; }
.setting-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.setting-description { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.setting-input { width: 100%; padding: 10px 12px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-primary); font-size: 14px; outline: none; }
.setting-input:focus { border-color: var(--accent-color); }

/* ── Setting row (label + toggle side by side) ── */
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.setting-row-label { font-size: 14px; font-weight: 500; color: var(--text-primary); margin-bottom: 3px; }
.setting-row-desc  { font-size: 12px; color: var(--text-tertiary); line-height: 1.5; }

/* ── Toggle switch ── */
.setting-toggle { display: inline-flex; cursor: pointer; flex-shrink: 0; margin-top: 2px; }
.setting-toggle input { display: none; }
.setting-toggle-track {
    width: 40px; height: 22px;
    background: var(--bg-tertiary);
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
    border: 1px solid var(--border-color);
}
.setting-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: var(--text-tertiary);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.setting-toggle input:checked + .setting-toggle-track {
    background: var(--search-accent);
    border-color: var(--search-accent);
}
.setting-toggle input:checked + .setting-toggle-track::after {
    transform: translateX(18px);
    background: #fff;
}

/* ══════════════════════════════════════════
   AIKLOAK AUTH MODAL
   Minimal account sign-in flow
   ══════════════════════════════════════════ */

.aik-auth-overlay {
    z-index: 1200;
}

.aik-auth-modal {
    position: relative;
    width: min(464px, calc(100vw - 32px));
    min-height: 560px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 26px;
    padding: 34px 30px 28px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .42);
    animation: fadeIn .24s ease both;
    display: flex;
    flex-direction: column;
}

.aik-auth-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-tertiary);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.aik-auth-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.aik-auth-top {
    text-align: center;
    padding: 4px 8px 26px;
}

.aik-auth-mark {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-color);
    margin: 0 auto 18px;
}

.aik-auth-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.aik-auth-top h2 {
    color: var(--text-primary);
    font-size: 27px;
    line-height: 1.12;
    letter-spacing: -.035em;
    margin: 0 0 16px;
    font-weight: 650;
}

.aik-auth-top h2 .aik-wordmark {
    letter-spacing: .015em;
    white-space: nowrap;
}

.aik-auth-legal {
    max-width: 360px;
    margin: 0 auto !important;
    color: var(--text-secondary) !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
}

.aik-auth-legal a {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 650;
}

.aik-auth-legal a:hover {
    color: #8DFF5A;
}

.aik-auth-actions {
    display: grid;
    gap: 12px;
    margin-top: 2px;
}

.aik-auth-provider {
    width: 100%;
    min-height: 58px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: grid;
    grid-template-columns: 34px 1fr 34px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 18px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 750;
    letter-spacing: 0.005em;
    text-align: center;
    transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.aik-auth-provider:hover {
    transform: translateY(-1px);
    background: var(--bg-hover);
    border-color: rgba(141, 255, 90, 0.58);
    box-shadow: 0 0 0 4px rgba(141, 255, 90, 0.08);
}

.aik-auth-provider span:last-child {
    justify-self: center;
}

.aik-auth-provider::after {
    content: "";
    width: 34px;
    height: 1px;
}

.aik-auth-provider-icon {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.aik-auth-github .aik-auth-provider-icon {
    background: #0d1117;
    color: #fff;
    border-color: rgba(255,255,255,.16);
}

.aik-auth-google .aik-auth-provider-icon {
    background: #fff;
    color: #111;
    border-color: rgba(0,0,0,.08);
}

.aik-auth-email .aik-auth-provider-icon {
    color: #050805;
    background: #8DFF5A;
    border-color: rgba(141, 255, 90, 0.52);
}

.aik-auth-email-form {
    display: block;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    border: 1px solid transparent;
    background: var(--bg-primary);
    border-radius: 22px;
    padding: 0 14px;
    margin-top: 0;
    transition: opacity .18s ease, height .18s ease, padding .18s ease, border-color .18s ease, margin .18s ease;
}

.aik-auth-email-form.open {
    height: 154px;
    opacity: 1;
    pointer-events: auto;
    padding: 14px;
    margin-top: 2px;
    border-color: var(--border-color);
}

.aik-auth-email-form input {
    width: 100%;
    height: 48px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0 16px;
    font-size: 14px;
    outline: none;
    margin-bottom: 10px;
    text-align: center;
}

.aik-auth-email-form input:focus {
    border-color: rgba(141, 255, 90, 0.72);
    box-shadow: 0 0 0 4px rgba(141, 255, 90, 0.08);
}

.aik-auth-email-form button {
    width: 100%;
    height: 48px;
    border-radius: 999px;
    border: 1px solid rgba(141, 255, 90, 0.52);
    background: #8DFF5A;
    color: #050805;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(141, 255, 90, 0.08);
}

.aik-auth-email-form button:hover {
    filter: brightness(1.04);
}

.aik-auth-email-form p {
    color: var(--text-tertiary);
    font-size: 11px;
    line-height: 1.45;
    text-align: center;
    margin: 10px 0 0;
}

.aik-auth-email-form p.sent {
    color: #5eb82f;
}

.aik-auth-status {
    display: none;
}

/* Light theme hardening: prevent washed-out auth buttons */
html[data-theme="light"] .aik-auth-modal {
    background: #ffffff;
    border-color: rgba(0,0,0,.12);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .18);
}

html[data-theme="light"] .aik-auth-provider {
    background: #ffffff;
    color: #111;
    border-color: rgba(0,0,0,.18);
    box-shadow: 0 1px 0 rgba(0,0,0,.04);
}

html[data-theme="light"] .aik-auth-provider:hover {
    background: #f7f7f4;
    border-color: rgba(0,0,0,.34);
    box-shadow: 0 0 0 4px rgba(141, 255, 90, 0.18);
}

html[data-theme="light"] .aik-auth-provider-icon {
    background: #f4f4ef;
    color: #111;
    border-color: rgba(0,0,0,.14);
}

html[data-theme="light"] .aik-auth-github .aik-auth-provider-icon {
    background: #0d1117;
    color: #fff;
}

html[data-theme="light"] .aik-auth-google .aik-auth-provider-icon {
    background: #fff;
}

html[data-theme="light"] .aik-auth-email .aik-auth-provider-icon,
html[data-theme="light"] .aik-auth-email-form button {
    background: #8DFF5A;
    color: #050805;
}

html[data-theme="light"] .aik-auth-email-form {
    background: #f7f7f4;
}

html[data-theme="light"] .aik-auth-email-form input {
    background: #fff;
    color: #111;
    border-color: rgba(0,0,0,.18);
}

html[data-theme="light"] .aik-auth-legal {
    color: #555 !important;
}

html[data-theme="light"] .aik-auth-legal a {
    color: #111;
}

@media (max-width: 480px) {
    .aik-auth-modal {
        width: min(430px, calc(100vw - 24px));
        min-height: 550px;
        padding: 30px 18px 24px;
        border-radius: 22px;
    }

    .aik-auth-provider {
        min-height: 56px;
        font-size: 14px;
        grid-template-columns: 32px 1fr 32px;
    }

    .aik-auth-provider-icon {
        width: 32px;
        height: 32px;
    }
}