.settings-page {
    padding-top: 8px;
}

.settings-container {
    max-width: 1100px;
    width: 100%;
}

.settings-intro {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 22px;
}

.settings-intro-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-intro-sub {
    font-size: 13px;
    color: var(--text-muted);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.settings-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-right {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
}

.settings-card {
    display: flex;
    gap: 18px;
    padding: 20px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-2xl);
    box-shadow: var(--shadow-card);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    overflow: hidden;
}

.settings-card:hover {
    border-color: var(--border-bright);
}

.settings-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--violet-glow);
    flex-shrink: 0;
    align-self: flex-start;
}

.settings-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.settings-card-label {
    display: flex;
    flex-direction: column;
}

.label-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.label-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.settings-card-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

.settings-input {
    flex: 1;
    min-width: 0;
    padding: 11px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-input:focus {
    border-color: var(--violet-bright);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.12);
}

.settings-input::placeholder {
    color: var(--text-muted);
}

.settings-btn {
    padding: 11px 22px;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.settings-btn-primary {
    background: linear-gradient(135deg, var(--violet-mid), var(--violet-bright));
    color: #fff;
}

.settings-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(139,92,246,0.4);
}

.settings-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-btn-secondary {
    background: var(--surface-2);
    color: var(--violet-glow);
    border: 1px solid var(--border-bright);
    align-self: flex-start;
}

.settings-btn-secondary:hover:not(:disabled) {
    background: var(--surface-3);
    box-shadow: 0 4px 20px rgba(139,92,246,0.15);
}

.settings-btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-btn-danger {
    background: rgba(239,68,68,0.1);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.25);
}

.settings-btn-danger:hover {
    background: rgba(239,68,68,0.2);
    border-color: rgba(239,68,68,0.4);
}

.settings-card-danger {
    border-color: rgba(239,68,68,0.12);
}

.settings-card-password {
    flex-shrink: 0;
}

.settings-password-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.settings-row { width: 100%; }

.settings-row-two {
    display: flex;
    gap: 10px;
}

.settings-row-two .settings-input {
    flex: 1;
    min-width: 0;
}

.pw-strength {
    display: flex;
    gap: 5px;
    height: 4px;
    margin-top: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.pw-strength.is-visible { opacity: 1; }

.pw-strength-bar {
    flex: 1;
    border-radius: 3px;
    background: var(--surface-3);
    transition: background 0.3s;
}

.pw-strength-bar.weak   { background: #ef4444; }
.pw-strength-bar.fair   { background: #f59e0b; }
.pw-strength-bar.good   { background: #a3e635; }
.pw-strength-bar.strong { background: #22c55e; }

.pw-strength-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    min-height: 14px;
}

.settings-card-login-history {
    display: flex;
    flex-direction: row;
    gap: 18px;
    padding: 20px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-2xl);
    box-shadow: var(--shadow-card);
    height: calc(100vh - 160px);
    max-height: 680px;
    min-height: 400px;
    overflow: hidden;
}

.settings-card-login-history > .settings-card-icon {
    flex-shrink: 0;
    align-self: flex-start;
}

.settings-card-login-history .settings-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 10px;
    overflow: hidden;
}

.login-history-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.login-history-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.login-history-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-right: 6px;
    min-height: 0;
}

.login-history-list::-webkit-scrollbar { width: 4px; }
.login-history-list::-webkit-scrollbar-track { background: transparent; }
.login-history-list::-webkit-scrollbar-thumb {
    background: var(--border-bright);
    border-radius: 99px;
}

.login-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 16px;
    color: var(--text-muted);
    flex: 1;
}

.login-history-empty i { font-size: 32px; opacity: 0.5; }
.login-history-empty span { font-size: 14px; }

.login-history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    flex-shrink: 0;
    transition: border-color 0.2s, background 0.2s;
}

.login-history-item:hover {
    border-color: var(--border-bright);
    background: var(--surface-3);
}

.history-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.history-icon.success { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.history-icon.failed  { background: rgba(239,68,68,0.15);  color: #fca5a5; }
.history-icon.unknown { background: rgba(139,92,246,0.15); color: var(--violet-glow); }

.history-info { flex: 1; min-width: 0; }

.history-ip {
    font-family: 'JetBrains Mono', 'Space Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-browser {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.history-browser i { font-size: 13px; color: var(--violet-glow); }

.history-language {
    color: var(--text-muted);
    font-size: 11px;
    background: var(--surface);
    padding: 1px 8px;
    border-radius: 99px;
    border: 1px solid var(--border);
}

.history-time {
    text-align: right;
    flex-shrink: 0;
    min-width: 80px;
}

.history-date {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.history-ago {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    width: 100%;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    background: var(--surface);
    border: 1px solid var(--border-bright);
    border-radius: 14px;
    box-shadow: var(--shadow-card), 0 10px 30px rgba(0,0,0,0.25);
    font-size: 13px;
    color: var(--text-primary);
    pointer-events: auto;
    animation: toastIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.toast-out { animation: toastOut 0.2s ease forwards; }

@keyframes toastOut {
    to { opacity: 0; transform: translateY(8px); }
}

.toast .toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.2s;
}

.toast .toast-close:hover { color: var(--text-primary); }

.spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes inputShake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-6px); }
    40%     { transform: translateX(6px); }
    60%     { transform: translateX(-4px); }
    80%     { transform: translateX(4px); }
}
.input-shake { animation: inputShake 0.35s ease; }

@keyframes btnSuccessFlash {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.6); }
    60%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
    100% { box-shadow: none; }
}
.btn-success-flash { animation: btnSuccessFlash 0.5s ease; }

@media (max-width: 900px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-right {
        position: static;
    }

    .settings-card-login-history {
        height: auto;
        max-height: none;
        min-height: unset;
    }

    .login-history-list {
        max-height: 360px;
    }
}

@media (max-width: 640px) {
    .settings-card {
        flex-direction: column;
        padding: 18px;
    }

    .settings-card-input {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-card-input .settings-btn {
        width: 100%;
        justify-content: center;
    }

    .settings-row-two { flex-direction: column; }

    .login-history-item { flex-wrap: wrap; }

    .login-history-item .history-time {
        text-align: left;
        width: 100%;
        padding-left: 50px;
        min-width: unset;
    }

    .login-history-list { max-height: 280px; }
}