:host {
    display: grid;
    gap: 1rem;
    --settings-field-border: var(--p-content-border-color);
    --settings-field-bg: var(--p-surface-0);
    --settings-field-bg-readonly: var(--p-surface-100);
    --settings-field-text: var(--p-text-color);
    --settings-field-placeholder: var(--p-text-muted-color);
}

:host-context(.p-dark) {
    --settings-field-border: var(--p-surface-700);
    --settings-field-bg: var(--p-surface-900);
    --settings-field-bg-readonly: var(--p-surface-800);
    --settings-field-text: var(--p-text-color);
    --settings-field-placeholder: var(--p-text-muted-color);
}

:host ::ng-deep .p-password input {
    width: 100%;
}

:host ::ng-deep .settings-action-btn {
    min-width: 10rem;
    justify-content: center;
}

:host ::ng-deep .p-inputotp {
    justify-content: flex-start;
}

:host ::ng-deep .p-inputotp-input {
    border-color: var(--settings-field-border);
    background: var(--settings-field-bg);
    color: var(--settings-field-text);
}

:host ::ng-deep .p-inputotp-input::placeholder {
    color: var(--settings-field-placeholder);
    opacity: 1;
}

.totp-secret {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
    line-height: 1.25rem;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--settings-field-border);
    background: var(--settings-field-bg-readonly);
    border-radius: 0.5rem;
    color: var(--settings-field-text);
    overflow-wrap: anywhere;
}

.totp-uri,
.passkey-name-input {
    width: 100%;
    min-height: 2.5rem;
    border: 1px solid var(--settings-field-border);
    border-radius: 0.5rem;
    background: var(--settings-field-bg);
    color: var(--settings-field-text);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.totp-uri[readonly] {
    background: var(--settings-field-bg-readonly);
}

.totp-uri::placeholder,
.passkey-name-input::placeholder {
    color: var(--settings-field-placeholder);
    opacity: 1;
}

.passkey-name-input:focus,
.totp-uri:focus {
    outline: none;
    box-shadow: 0 0 0 1px var(--p-primary-color);
    border-color: var(--p-primary-color);
}

.passkey-list {
    display: grid;
    gap: 0.75rem;
}

.passkey-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--settings-field-border);
    border-radius: 8px;
    background: var(--settings-field-bg);
}

.passkey-meta {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.recovery-codes-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--settings-field-border);
    border-radius: 8px;
    background: var(--settings-field-bg);
}

.recovery-codes-summary-copy {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.recovery-codes-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--p-primary-color) 12%, transparent);
    color: var(--p-primary-color);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1rem;
}

.recovery-codes-panel {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--settings-field-border);
    border-radius: 8px;
    background: var(--settings-field-bg-readonly);
}

.recovery-codes-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.recovery-codes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 0.75rem;
}

.recovery-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--settings-field-border);
    border-radius: 8px;
    background: var(--settings-field-bg);
    color: var(--settings-field-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

@media (max-width: 640px) {
    :host ::ng-deep .settings-action-btn {
        width: 100%;
    }

    .passkey-item {
        flex-direction: column;
        align-items: stretch;
    }

    .recovery-codes-summary {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (min-width: 960px) {
    :host {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }
}
