.qm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 250ms ease;
}

.qm-overlay.is-visible {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.qm-modal {
    width: 520px;
    max-width: 92vw;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 250ms ease;
}

.qm-overlay.is-visible .qm-modal {
    transform: translateY(0);
}

.qm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.qm-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.qm-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 200ms ease;
}

.qm-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.qm-body {
    padding: 24px;
}

.qm-field {
    margin-bottom: 20px;
}

.qm-field:last-child {
    margin-bottom: 0;
}

.qm-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.qm-label-required {
    color: #f43f5e;
    margin-left: 2px;
}

.qm-software-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.qm-software-logo {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: contain;
}

.qm-software-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.qm-software-search {
    position: relative;
}

.qm-software-search-input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #0f172a;
    background: #fff;
    outline: none;
    transition: border-color 200ms ease, box-shadow 200ms ease;
    font-family: inherit;
}

.qm-software-search-input:focus {
    border-color: #1677ff;
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

.qm-software-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
}

.qm-software-search-dropdown.is-visible {
    display: block;
}

.qm-software-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 150ms ease;
}

.qm-software-search-item:hover {
    background: #f8fafc;
}

.qm-software-search-item-name {
    font-size: 14px;
    color: #0f172a;
}

.qm-software-selected {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #e8f3ff;
    border: 1px solid rgba(22, 119, 255, 0.3);
    border-radius: 8px;
}

.qm-software-selected.is-visible {
    display: flex;
}

.qm-software-selected-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #1677ff;
}

.qm-software-selected-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(22, 119, 255, 0.1);
    border-radius: 4px;
    color: #1677ff;
    cursor: pointer;
    transition: all 200ms ease;
}

.qm-software-selected-clear:hover {
    background: #1677ff;
    color: #fff;
}

.qm-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #0f172a;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 200ms ease, box-shadow 200ms ease;
    font-family: inherit;
}

.qm-textarea:focus {
    border-color: #1677ff;
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

.qm-textarea::placeholder {
    color: #94a3b8;
}

.qm-textarea-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.qm-error {
    font-size: 12px;
    color: #f43f5e;
    display: none;
}

.qm-error.is-visible {
    display: block;
}

.qm-counter {
    font-size: 12px;
    color: #94a3b8;
}

.qm-counter.is-warning {
    color: #f59e0b;
}

.qm-counter.is-danger {
    color: #f43f5e;
}

.qm-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.qm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 200ms ease;
    border: none;
    font-family: inherit;
}

.qm-btn--cancel {
    background: #fff;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.qm-btn--cancel:hover {
    border-color: #cbd5e1;
    color: #334155;
}

.qm-btn--submit {
    background: linear-gradient(135deg, #1677ff, #06b6d4);
    color: #fff;
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.25);
}

.qm-btn--submit:hover {
    background: linear-gradient(135deg, #4096ff, #22d3ee);
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.35);
}

.qm-btn--submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.qm-success {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.qm-success.is-visible {
    display: flex;
}

.qm-success-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ecfdf5;
    border-radius: 50%;
    color: #10b981;
    margin-bottom: 16px;
}

.qm-success-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.qm-success-desc {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
}

.qm-success-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #1677ff, #06b6d4);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 200ms ease;
}

.qm-success-link:hover {
    background: linear-gradient(135deg, #4096ff, #22d3ee);
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.35);
}

.qm-login-tip {
    padding: 24px;
    text-align: center;
}

.qm-login-tip-text {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 16px;
}

.qm-login-tip-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #1677ff, #06b6d4);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 200ms ease;
}

.qm-login-tip-link:hover {
    background: linear-gradient(135deg, #4096ff, #22d3ee);
}

@media screen and (max-width: 768px) {
    .qm-modal {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 12px 12px 0 0;
    }

    .qm-overlay.is-visible {
        align-items: flex-end;
    }

    .qm-header {
        padding: 16px 18px;
    }

    .qm-title {
        font-size: 16px;
    }

    .qm-body {
        padding: 18px;
    }

    .qm-field {
        margin-bottom: 16px;
    }

    .qm-textarea {
        min-height: 100px;
    }

    .qm-footer {
        padding: 14px 18px;
        gap: 8px;
    }

    .qm-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media screen and (max-width: 480px) {
    .qm-modal {
        border-radius: 12px 12px 0 0;
    }

    .qm-body {
        padding: 14px;
    }

    .qm-footer {
        flex-direction: column;
        padding: 12px 14px;
    }

    .qm-btn {
        width: 100%;
        justify-content: center;
    }

    .qm-success {
        padding: 32px 16px;
    }

    .qm-success-title {
        font-size: 16px;
    }
}
