/* ============================================================
   dashboard-settings.css — Account Settings (reimagined)
   OLED Monochromatic  |  True black  |  Violet accent
   ============================================================ */

@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes pulse-glow { 0%,100% { box-shadow: 0 0 12px rgba(139,92,246,.25); } 50% { box-shadow: 0 0 24px rgba(139,92,246,.45); } }
.rotating, .spin { animation: rotate 1s linear infinite; }

/* ── Page Layout ──────────────────────────────────────────── */
.st-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

/* ── Profile Hero ─────────────────────────────────────────── */
.st-hero {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    margin-bottom: 28px;
}

.st-hero-bg {
    height: 100px;
    background: linear-gradient(135deg, #1a0a2e 0%, #0d0d1a 40%, #0a0a14 100%);
    position: relative;
}
.st-hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 200px at 30% 80%, rgba(139,92,246,.12), transparent),
        radial-gradient(ellipse 400px 150px at 70% 60%, rgba(34,197,94,.06), transparent);
}

.st-hero-body {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    padding: 0 24px 20px;
    margin-top: -48px;
    position: relative;
    z-index: 1;
}

.st-hero-avatar {
    position: relative;
    flex-shrink: 0;
}
.st-hero-avatar img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg-secondary);
    background: var(--bg-tertiary);
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.st-hero-avatar-overlay {
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
    cursor: pointer;
}
.st-hero-avatar-overlay .material-icons { font-size: 28px; color: #fff; }
.st-hero-avatar:hover .st-hero-avatar-overlay { opacity: 1; }

.st-hero-info { flex: 1; min-width: 0; padding-bottom: 4px; }
.st-hero-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.st-hero-role {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(139,92,246,.12);
    color: var(--accent-primary);
}
.st-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
}
.st-hero-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .78rem;
    color: var(--text-muted);
}
.st-hero-meta-item .material-icons { font-size: 15px; }

.st-hero-stats {
    display: flex;
    gap: 12px;
    padding-bottom: 4px;
}
.st-hero-stat {
    text-align: center;
    padding: 8px 14px;
    background: rgba(255,255,255,.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 8px);
    min-width: 70px;
}
.st-hero-stat-val {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.st-hero-stat-lbl {
    display: block;
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Section Cards ────────────────────────────────────────── */
.st-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 16px);
    margin-bottom: 20px;
    overflow: hidden;
}

.st-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.st-section-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}
.st-section-icon .material-icons { font-size: 20px; }
.st-section-icon.violet { background: rgba(139,92,246,.1); }
.st-section-icon.violet .material-icons { color: var(--accent-primary); }
.st-section-icon.emerald { background: rgba(34,197,94,.1); }
.st-section-icon.emerald .material-icons { color: var(--emerald, #22c55e); }
.st-section-icon.amber { background: rgba(245,158,11,.1); }
.st-section-icon.amber .material-icons { color: var(--amber, #f59e0b); }
.st-section-icon.danger { background: rgba(244,63,94,.1); }
.st-section-icon.danger .material-icons { color: var(--danger, #f43f5e); }

.st-section-title {
    font-size: .92rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.st-section-desc {
    font-size: .72rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.st-section-body { padding: 20px; }

/* ── Form Elements ────────────────────────────────────────── */
.st-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.st-grid.full { grid-template-columns: 1fr; }

.st-field { margin-bottom: 0; }
.st-field label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.st-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 8px);
    color: var(--text-primary);
    font-size: .88rem;
    font-family: inherit;
    transition: border-color .2s, background .2s;
}
.st-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(139,92,246,.03);
}
.st-input:read-only {
    opacity: .5;
    cursor: not-allowed;
}
.st-input::placeholder { color: var(--text-muted); }

.st-input-prefix {
    position: relative;
    display: flex;
    align-items: center;
}
.st-input-prefix .prefix-label {
    position: absolute;
    left: 14px;
    font-size: .88rem;
    color: var(--text-muted);
    font-weight: 600;
    pointer-events: none;
}
.st-input-prefix .st-input { padding-left: 32px; }

.st-hint {
    display: block;
    font-size: .7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Avatar upload area */
.st-avatar-area {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
}
.st-avatar-actions { flex: 1; }
.st-avatar-actions h4 {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 4px 0 6px;
}
.st-avatar-actions p {
    font-size: .75rem;
    color: var(--text-muted);
    margin: 0 0 12px;
    line-height: 1.5;
}
.st-avatar-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.st-avatar-url-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.st-avatar-url-row .st-input { flex: 1; }

/* Password field w/ toggle */
.st-pw-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.st-pw-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    transition: color .2s;
}
.st-pw-toggle:hover { color: var(--text-primary); }
.st-pw-toggle .material-icons { font-size: 19px; }

/* Password strength */
.st-strength {
    margin-top: 8px;
}
.st-strength-bar {
    width: 100%;
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}
.st-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width .3s, background .3s;
}
.st-strength-fill.weak { width: 33%; background: var(--danger); }
.st-strength-fill.medium { width: 66%; background: var(--amber, #f59e0b); }
.st-strength-fill.strong { width: 100%; background: var(--emerald, #22c55e); }
.st-strength-text {
    font-size: .7rem;
    color: var(--text-muted);
}
.st-strength-text.weak { color: var(--danger); }
.st-strength-text.medium { color: var(--amber, #f59e0b); }
.st-strength-text.strong { color: var(--emerald, #22c55e); }

/* ── Buttons ──────────────────────────────────────────────── */
.st-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}

.st-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm, 8px);
    font-size: .82rem;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.st-btn .material-icons { font-size: 18px; }

.st-btn-primary {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}
.st-btn-primary:hover {
    background: var(--accent-hover, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(139,92,246,.3);
}

.st-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.st-btn-secondary:hover {
    background: var(--bg-hover, rgba(255,255,255,.06));
    border-color: var(--accent-primary);
}

.st-btn-danger {
    background: rgba(244,63,94,.08);
    color: var(--danger);
    border-color: rgba(244,63,94,.2);
}
.st-btn-danger:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(244,63,94,.3);
}

.st-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ── 2FA Section ──────────────────────────────────────────── */
.st-2fa-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255,255,255,.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 8px);
    margin-bottom: 16px;
}
.st-2fa-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
}
.st-2fa-badge.on {
    background: rgba(34,197,94,.12);
    color: var(--emerald, #22c55e);
}
.st-2fa-badge.off {
    background: rgba(156,163,175,.12);
    color: var(--text-muted);
}
.st-2fa-badge .material-icons { font-size: 16px; }

.st-2fa-info { flex: 1; min-width: 0; }
.st-2fa-info p { font-size: .8rem; color: var(--text-secondary); margin: 0; line-height: 1.5; }
.st-2fa-info small { font-size: .7rem; color: var(--text-muted); }

.st-2fa-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Compatible apps */
.st-apps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}
.st-app-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: .72rem;
    color: var(--text-secondary);
}

/* 2FA Setup Form */
.st-2fa-setup h4 {
    margin: 0 0 20px;
    font-size: 1rem;
    color: var(--text-primary);
}
.st-setup-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.st-step {
    display: flex;
    gap: 14px;
}
.st-step-num {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-primary);
    color: #fff;
    border-radius: 50%;
    font-size: .78rem;
    font-weight: 700;
    flex-shrink: 0;
}
.st-step-body { flex: 1; }
.st-step-body p { font-size: .82rem; color: var(--text-secondary); margin: 0 0 12px; line-height: 1.5; }

.st-qr-wrap {
    display: flex;
    justify-content: center;
    padding: 14px;
    background: #fff;
    border-radius: 12px;
    width: fit-content;
    margin: 0 auto 12px;
}
.st-qr-wrap img { width: 180px; height: 180px; }

.st-manual-entry { margin-top: 10px; }
.st-manual-entry summary {
    cursor: pointer;
    color: var(--accent-primary);
    font-size: .82rem;
}
.st-secret-key {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}
.st-secret-key code {
    flex: 1;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: .82rem;
    word-break: break-all;
    color: var(--text-primary);
}

.st-code-input {
    width: 170px;
    padding: 14px;
    font-size: 1.4rem;
    font-family: 'SF Mono', Monaco, monospace;
    text-align: center;
    letter-spacing: 6px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: border-color .2s;
}
.st-code-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Backup codes */
.st-backup-warning {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: rgba(234,179,8,.08);
    border: 1px solid rgba(234,179,8,.2);
    border-radius: 10px;
    margin-bottom: 16px;
}
.st-backup-warning .material-icons { color: #eab308; font-size: 22px; flex-shrink: 0; }
.st-backup-warning p { margin: 0; font-size: .82rem; color: var(--text-secondary); line-height: 1.5; }

.st-backup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}
.st-backup-code {
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: .85rem;
    text-align: center;
    color: var(--text-primary);
}

/* Success header */
.st-success-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.st-success-head .material-icons { font-size: 40px; color: var(--emerald, #22c55e); }
.st-success-head h4 { margin: 0; font-size: 1.15rem; color: var(--text-primary); }

/* ── Danger Zone ──────────────────────────────────────────── */
.st-section.danger {
    border-color: rgba(244,63,94,.15);
}
.st-section.danger .st-section-head {
    border-bottom-color: rgba(244,63,94,.1);
}

.st-danger-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}
.st-danger-info h4 {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
}
.st-danger-info p {
    font-size: .78rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ── Modal (2FA) ──────────────────────────────────────────── */
.st-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.st-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    margin: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,.5);
}
.st-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.st-modal-head h3 { margin: 0; font-size: 1rem; color: var(--text-primary); }
.st-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 0;
}
.st-modal-close:hover { color: var(--text-primary); }
.st-modal-body { padding: 20px; }
.st-modal-body p { margin: 0 0 16px; font-size: .85rem; color: var(--text-secondary); line-height: 1.5; }
.st-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
}

.st-warning-box {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.2);
    border-radius: 10px;
    margin-bottom: 16px;
}
.st-warning-box .material-icons { color: #ef4444; font-size: 22px; flex-shrink: 0; }
.st-warning-box p { margin: 0; font-size: .85rem; color: var(--text-secondary); }

/* ── 2FA Setup Form ────────────────────────────────────── */
.st-2fa-setup h4 { color: var(--text-primary); margin: 0 0 20px; font-size: 1.05rem; }
.st-qr-wrap {
    display: flex; justify-content: center; margin: 16px 0;
    background: #fff; border-radius: 10px; padding: 12px; width: fit-content; margin-inline: auto;
}
.st-qr-wrap img { width: 200px; height: 200px; display: block; }
.st-manual-entry { margin-top: 12px; }
.st-manual-entry summary {
    cursor: pointer; font-size: .82rem; color: var(--accent-primary);
    user-select: none; padding: 4px 0;
}
.st-secret-key {
    display: flex; align-items: center; gap: 8px; margin-top: 10px;
    background: var(--bg-tertiary); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 10px 14px;
}
.st-secret-key code {
    font-family: 'JetBrains Mono', monospace; font-size: .82rem;
    color: var(--text-primary); word-break: break-all; flex: 1;
}
.st-apps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.st-app-badge {
    font-size: .72rem; color: var(--text-muted); padding: 4px 10px;
    background: var(--bg-tertiary); border: 1px solid var(--border-color);
    border-radius: 20px;
}
.st-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Loading State ────────────────────────────────────────── */
.st-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px;
    color: var(--text-muted);
    font-size: .85rem;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .st-page { padding: 20px 16px 48px; }
    .st-hero-body { flex-direction: column; align-items: flex-start; gap: 14px; }
    .st-hero-stats { align-self: stretch; justify-content: space-around; }
    .st-grid { grid-template-columns: 1fr; }
    .st-avatar-area { flex-direction: column; align-items: center; text-align: center; }
    .st-danger-item { flex-direction: column; align-items: flex-start; }
    .st-actions { flex-direction: column; }
    .st-btn { width: 100%; justify-content: center; }
    .st-2fa-status { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .st-hero-avatar img { width: 76px; height: 76px; }
    .st-hero-bg { height: 80px; }
    .st-hero-body { margin-top: -38px; }
    .st-section-body { padding: 16px; }
}

/* ── Sessions ────────────────────────────────────────────── */
.sessions-list { display: flex; flex-direction: column; gap: 6px; }
.session-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 10px;
    background: var(--bg-secondary); border: 1px solid var(--border);
    transition: border-color .2s;
}
.session-row:hover { border-color: var(--border-hover); }
.session-current { border-color: var(--accent); background: rgba(139,92,246,.06); }
.session-icon {
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
}
.session-current .session-icon { color: var(--accent); }
.session-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.session-device { font-size: .875rem; font-weight: 500; color: var(--text-primary); }
.session-meta { font-size: .75rem; color: var(--text-muted); }
.session-badge-current {
    display: inline-block; font-size: .65rem; font-weight: 600;
    padding: 1px 6px; border-radius: 4px;
    background: var(--accent); color: #fff; margin-left: 6px;
    vertical-align: middle;
}
.session-revoke-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 6px; border-radius: 6px;
    transition: color .2s, background .2s;
}
.session-revoke-btn:hover { color: #ef4444; background: rgba(239,68,68,.1); }
.st-btn-sm { font-size: .8rem; padding: 6px 12px; }
.st-section-icon.blue { background: rgba(59,130,246,.12); color: #3b82f6; }

/* ── Discord Webhooks ───────────────────────────────────── */
.webhooks-list { display: flex; flex-direction: column; gap: 8px; }
.webhook-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border-radius: 8px;
    background: var(--bg-secondary, #0a0a0a);
    border: 1px solid var(--border, #1a1a1a);
    transition: border-color .2s;
}
.webhook-row:hover { border-color: var(--accent); }
.webhook-icon {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(88,101,242,.15); color: #5865F2; flex-shrink: 0;
}
.webhook-info { flex: 1; min-width: 0; }
.webhook-name { font-size: .875rem; font-weight: 500; color: var(--text-primary); }
.webhook-meta { font-size: .75rem; color: var(--text-muted); }
.webhook-events-count {
    display: inline-block; font-size: .65rem; font-weight: 600;
    padding: 1px 6px; border-radius: 4px;
    background: rgba(88,101,242,.15); color: #5865F2; margin-left: 6px;
}
.webhook-status-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.webhook-status-dot.active { background: #22c55e; }
.webhook-status-dot.inactive { background: #6b7280; }
.webhook-actions { display: flex; gap: 4px; }
.webhook-actions button {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 6px; border-radius: 6px;
    transition: color .2s, background .2s;
}
.webhook-actions button:hover { color: var(--text-primary); background: var(--bg-hover, rgba(255,255,255,.05)); }
.webhook-actions button.danger:hover { color: #ef4444; background: rgba(239,68,68,.1); }
.webhook-events-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px;
}
.webhook-event-chip {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; border-radius: 6px; font-size: .75rem;
    background: var(--bg-secondary, #0a0a0a);
    border: 1px solid var(--border, #1a1a1a);
    cursor: pointer; user-select: none; transition: all .2s;
}
.webhook-event-chip input { display: none; }
.webhook-event-chip.selected {
    border-color: #5865F2; background: rgba(88,101,242,.1); color: #5865F2;
}
.webhook-empty {
    text-align: center; padding: 24px; color: var(--text-muted); font-size: .85rem;
}

/* ── API Keys ── */
.apikeys-list { display: flex; flex-direction: column; gap: 8px; }

.scope-badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: 10px;
    font-size: .7rem; font-weight: 500;
    background: rgba(16,185,129,.08); color: #10b981;
    border: 1px solid rgba(16,185,129,.15);
}

.apikey-scopes-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.apikey-scopes-grid label {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px; border-radius: 8px;
    background: var(--bg-primary); border: 1px solid var(--border-primary);
    cursor: pointer; font-size: .8rem; color: var(--text-secondary);
    transition: all .2s;
}
.apikey-scopes-grid label:hover {
    border-color: var(--accent); color: var(--text-primary);
}
.apikey-scopes-grid input:checked + span {
    color: #10b981;
}

@media (max-width: 600px) {
    .apikey-scopes-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 400px) {
    .apikey-scopes-grid { grid-template-columns: 1fr; }
}

/* ── API Key Modal ─────────────────────────────────────────── */
.ak-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.ak-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    width: 440px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0,0,0,.5);
    animation: akSlide .2s ease-out;
}
@keyframes akSlide {
    from { opacity: 0; transform: translateY(-12px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ak-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.ak-modal-head h3 {
    margin: 0;
    font-size: .95rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ak-modal-head h3 .material-icons { font-size: 20px; color: #10b981; }
.ak-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    transition: all .15s;
}
.ak-modal-close:hover { color: var(--text-primary); background: var(--bg-hover, rgba(255,255,255,.06)); }

.ak-modal-body {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.ak-field { display: flex; flex-direction: column; gap: 5px; }
.ak-field label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .4px;
}
.ak-input {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 9px 11px;
    font-size: .84rem;
    transition: border-color .15s;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}
.ak-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16,185,129,.2);
}

.ak-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.ak-warning {
    background: rgba(245,158,11,.08);
    border: 1px solid rgba(245,158,11,.2);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f59e0b;
    font-size: .85rem;
}
.ak-key-display {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px;
    font-family: monospace;
    font-size: .85rem;
    word-break: break-all;
    color: var(--text-primary);
    margin-bottom: 8px;
}

@media (max-width: 480px) {
    .ak-modal { width: 100%; }
}

/* ── Webhook Modal ─────────────────────────────────────────── */
.wh-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.wh-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    width: 420px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0,0,0,.5);
    animation: whSlide .2s ease-out;
}
@keyframes whSlide {
    from { opacity: 0; transform: translateY(-12px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.wh-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.wh-modal-head h3 {
    margin: 0;
    font-size: .95rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.wh-modal-head h3 .material-icons { font-size: 20px; color: #5865F2; }
.wh-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    transition: all .15s;
}
.wh-modal-close:hover { color: var(--text-primary); background: var(--bg-hover, rgba(255,255,255,.06)); }

.wh-modal-body {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.wh-field { display: flex; flex-direction: column; gap: 5px; }
.wh-field label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .4px;
}
.wh-input {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 9px 11px;
    font-size: .84rem;
    transition: border-color .15s;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}
.wh-input:focus {
    border-color: #5865F2;
    box-shadow: 0 0 0 2px rgba(88,101,242,.2);
}

/* Events grid — 2 columns, scrollable */
.wh-events {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}
.wh-events::-webkit-scrollbar { width: 4px; }
.wh-events::-webkit-scrollbar-track { background: transparent; }
.wh-events::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.wh-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 9px;
    border-radius: 7px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: .75rem;
    color: var(--text-secondary);
    transition: all .15s;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wh-chip:hover {
    border-color: rgba(88,101,242,.4);
    color: var(--text-primary);
}
.wh-chip.selected {
    border-color: #5865F2;
    background: rgba(88,101,242,.1);
    color: #a5b4fc;
}
.wh-chip input[type="checkbox"] {
    accent-color: #5865F2;
    margin: 0;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.wh-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .wh-modal { width: 100%; }
    .wh-events { grid-template-columns: 1fr; max-height: 160px; }
}

