.settings-wrapper {
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 12px;
    padding: 24px 28px;
    box-shadow: 0 8px 28px var(--shadow-color, rgba(13, 110, 253, 0.12));
    max-width: 640px;
    margin: 0 auto 28px auto;
}
.settings-wrapper h2 {
    margin-top: 0;
    color: var(--primary-color, #0b5ed7);
}
.settings-wrapper p.prompt {
    margin: 0 0 16px;
    color: var(--text-main, #495057);
}
.form-field {
    margin-bottom: 18px;
}
.form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main, #343a40);
}
.form-field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #ced4da);
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--bg-input, #ffffff);
    color: var(--text-main, #212529);
}
.form-field input:focus {
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
    outline: none;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}
.form-actions .ui-action,
.open-alias-modal-btn,
.server-alias-actions .ui-action {
    min-height: 46px;
    padding: 12px 20px;
}
.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 0.95rem;
}
.alert-info {
    background: rgba(13, 110, 253, 0.1);
    border: 1px solid rgba(13, 110, 253, 0.2);
    color: var(--primary-color, #1d4ed8);
}
.alert-error {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
    color: #dc3545;
}
.requirement-list {
    background: var(--bg-hover, #f8f9fa);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 20px;
    color: var(--text-muted, #6c757d);
}
.requirement-list ul {
    margin: 0;
    padding-left: 20px;
}
.requirement-list li {
    margin-bottom: 6px;
}
.alias-manage-entry {
    margin-bottom: 20px;
}
.settings-modal-entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 10px;
}
.settings-modal-entry-grid .ui-action {
    width: 100%;
}
.settings-modal-hint {
    margin: 0;
    color: var(--text-muted, #6c757d);
    font-size: 0.92rem;
}
.open-alias-modal-btn {
    min-width: 240px;
}
.layer-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(1.5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}
.auth-settings-embedded .layer-modal {
    position: static;
    inset: auto;
    background: transparent;
    backdrop-filter: none;
    padding: 0;
    z-index: auto;
}
.layer-modal.is-open {
    display: flex;
    animation: layerModalFadeIn 0.2s ease-out;
}
.auth-settings-embedded .layer-modal.is-open {
    display: block;
    animation: none;
}
.layer-modal.is-closing {
    display: flex;
    animation: layerModalFadeOut 0.18s ease-in forwards;
}
.auth-settings-embedded .layer-modal.is-closing {
    display: block;
    animation: none;
}
.layer-modal-dialog {
    width: min(680px, 100%);
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 12px;
    box-shadow: 0 20px 38px rgba(15, 23, 42, 0.26), 0 10px 24px rgba(37, 99, 235, 0.14);
    padding: 18px 20px 20px;
    animation: layerDialogPopIn 0.24s cubic-bezier(0.2, 0.75, 0.22, 1);
    transform-origin: center top;
}
.auth-settings-embedded .layer-modal-dialog {
    width: min(760px, 100%);
    margin: 8px auto;
    animation: none;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.18), 0 8px 20px rgba(37, 99, 235, 0.1);
}
.layer-modal.is-closing .layer-modal-dialog {
    animation: layerDialogPopOut 0.18s ease-in forwards;
}
.auth-settings-embedded .layer-modal.is-closing .layer-modal-dialog {
    animation: none;
}
.layer-modal-dialog--narrow {
    width: min(640px, 100%);
}
.layer-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -18px -20px 16px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(30, 64, 175, 0.06) 100%);
    border-bottom: 1px solid rgba(37, 99, 235, 0.18);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}
.layer-modal-header h3 {
    margin: 0;
    color: #1d4ed8;
    font-size: 1.1rem;
    line-height: 1.35;
    letter-spacing: 0.01em;
}
.layer-modal-close {
    border: 1px solid rgba(37, 99, 235, 0.2);
    background: rgba(255, 255, 255, 0.92);
    color: #334155;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.layer-modal-close:hover {
    background: #eff6ff;
    border-color: rgba(37, 99, 235, 0.34);
    color: #1e40af;
}
.auth-settings-embedded .layer-modal-close {
    display: none;
}
.layer-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.modal-prompt {
    margin: 0;
    color: var(--text-muted, #6c757d);
    line-height: 1.6;
    font-size: 0.98rem;
}
.server-identity-panel {
    background: var(--bg-hover, #f8f9fa);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 10px;
    padding: 14px 16px;
}
.server-identity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 14px;
    margin: 0;
}
.server-identity-label {
    font-size: 12px;
    color: var(--text-muted, #6c757d);
    margin-bottom: 4px;
    font-weight: 600;
    line-height: 1.35;
}
.server-identity-value {
    font-size: 14px;
    color: var(--text-main, #343a40);
    line-height: 1.45;
    word-break: break-all;
}
.server-alias-form {
    display: block;
}
.server-alias-form .form-field {
    margin-bottom: 0;
}
.server-alias-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}
.server-alias-actions .ui-action {
    min-width: 132px;
}
.layer-modal .ui-action--primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.24);
}
.layer-modal .ui-action--primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 10px 18px rgba(30, 64, 175, 0.28);
}
.layer-modal .ui-action--secondary {
    background: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.5);
    color: #1e293b;
    box-shadow: none;
}
.layer-modal .ui-action--secondary:hover {
    background: #cbd5e1;
}
.settings-modal-entry-grid .ui-action--primary,
.settings-modal-entry-grid .ui-action--navy {
    min-height: 48px;
    box-shadow: 0 8px 16px rgba(30, 64, 175, 0.22);
}
.settings-modal-entry-grid .ui-action--navy {
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
    border-color: rgba(30, 64, 175, 0.4);
}
.settings-modal-entry-grid .ui-action--navy:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
}
@keyframes layerModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
@keyframes layerDialogPopIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes layerModalFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}
@keyframes layerDialogPopOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(8px) scale(0.99);
    }
}
@media (prefers-reduced-motion: reduce) {
    .layer-modal.is-open,
    .layer-modal.is-closing,
    .layer-modal-dialog,
    .layer-modal.is-closing .layer-modal-dialog {
        animation: none;
    }
}
[data-theme='dark'] .layer-modal {
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(2px);
}
.auth-settings-embedded[data-theme='dark'] .layer-modal,
[data-theme='dark'] .auth-settings-embedded .layer-modal {
    background: transparent;
    backdrop-filter: none;
}
[data-theme='dark'] .layer-modal-dialog {
    background: var(--bg-card, #0f172a);
    border-color: rgba(148, 163, 184, 0.22);
    box-shadow: 0 22px 44px rgba(2, 6, 23, 0.75), 0 10px 24px rgba(37, 99, 235, 0.2);
}
[data-theme='dark'] .layer-modal-header {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.22) 0%, rgba(30, 64, 175, 0.14) 100%);
    border-bottom-color: rgba(96, 165, 250, 0.32);
}
[data-theme='dark'] .layer-modal-header h3 {
    color: #93c5fd;
}
[data-theme='dark'] .layer-modal-close {
    background: rgba(15, 23, 42, 0.88);
    border-color: rgba(148, 163, 184, 0.36);
    color: #cbd5e1;
}
[data-theme='dark'] .layer-modal-close:hover {
    background: rgba(37, 99, 235, 0.2);
    border-color: rgba(96, 165, 250, 0.5);
    color: #dbeafe;
}
[data-theme='dark'] .modal-prompt,
[data-theme='dark'] .settings-modal-hint {
    color: #a5b4c8;
}
[data-theme='dark'] .requirement-list,
[data-theme='dark'] .server-identity-panel {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.24);
    color: #cbd5e1;
}
[data-theme='dark'] .server-identity-label {
    color: #93c5fd;
}
[data-theme='dark'] .server-identity-value {
    color: #f1f5f9;
}
[data-theme='dark'] .layer-modal .ui-action--primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.34);
}
[data-theme='dark'] .layer-modal .ui-action--primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 10px 18px rgba(30, 64, 175, 0.4);
}
[data-theme='dark'] .layer-modal .ui-action--secondary {
    background: rgba(51, 65, 85, 0.92);
    border-color: rgba(148, 163, 184, 0.45);
    color: #e2e8f0;
}
[data-theme='dark'] .layer-modal .ui-action--secondary:hover {
    background: rgba(71, 85, 105, 0.96);
}
[data-theme='dark'] .settings-modal-entry-grid .ui-action--primary,
[data-theme='dark'] .settings-modal-entry-grid .ui-action--navy {
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3);
}
[data-theme='dark'] .settings-modal-entry-grid .ui-action--navy {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    border-color: rgba(96, 165, 250, 0.42);
}
[data-theme='dark'] .settings-modal-entry-grid .ui-action--navy:hover {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
}
@media (max-width: 640px) {
    .layer-modal {
        padding: 14px;
    }
    .layer-modal-dialog {
        padding: 14px 14px 16px;
    }
    .auth-settings-embedded .layer-modal-dialog {
        width: 100%;
        margin: 0;
    }
    .layer-modal-header {
        margin: -14px -14px 12px;
        padding: 12px 12px;
    }
    .layer-modal-header h3 {
        font-size: 1rem;
    }
    .modal-prompt {
        font-size: 0.93rem;
        line-height: 1.55;
    }
    .requirement-list {
        padding: 12px 13px;
        font-size: 0.9rem;
    }
    .server-identity-panel {
        padding: 12px 13px;
    }
    .server-identity-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .server-identity-label {
        font-size: 11px;
    }
    .server-identity-value {
        font-size: 13px;
    }
    .form-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }
    .settings-modal-entry-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .settings-modal-entry-grid .ui-action,
    .form-actions .ui-action,
    .server-alias-actions .ui-action,
    .open-alias-modal-btn {
        min-height: 52px;
        padding: 14px 16px;
        font-size: 0.96rem;
    }
    .form-actions .ui-action,
    .open-alias-modal-btn {
        width: 100%;
    }
    .server-alias-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }
    .server-alias-actions .ui-action {
        width: 100%;
    }
}