.file-match {
    display: grid;
    align-items: center;
    gap: clamp(22px, 4vw, 56px);
    margin: 20px 0;
    padding: clamp(18px, 3.6vw, 44px);
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(135deg, #ecf4fc 0%, #fff 72%);
    box-shadow: 0 16px 42px rgb(16 34 52 / 8%);
}

.file-match:has(.file-match__form:not([hidden])) {
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
}

.file-match__intro {
    min-width: 0;
}

.file-match__intro h2 {
    margin: 0 0 10px;
    color: var(--navy);
    font-size: clamp(2rem, 4.1vw, 3.5rem);
    line-height: .98;
}

.file-match__intro > p:not(.file-match__brand) {
    max-width: 34ch;
    margin: 0 0 14px;
    color: var(--muted);
    line-height: 1.55;
}

.file-match__brand {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 15px;
    color: var(--blue-dark);
    font-size: .86rem;
    font-weight: 700;
}

.file-match__badge,
.file-match__drop-icon {
    display: inline-grid;
    flex: none;
    place-items: center;
}

.file-match__badge {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: #fff;
    box-shadow: inset 0 0 0 1px #d1e1f1;
}

.file-match__badge .icon {
    width: 18px;
    height: 18px;
}

.file-match__form {
    min-width: 0;
    margin: 0;
}

.file-match__drop {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    min-height: 188px;
    padding: clamp(12px, 2.3vw, 24px);
    border: 1px dashed #91aecc;
    border-radius: 13px;
    background: #f8fbff;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.file-match__drop:focus-within,
.file-match__drop.is-dragging {
    border-color: var(--blue);
}

.file-match__drop.is-dragging {
    background: #e0efff;
    box-shadow: inset 0 0 0 1px var(--blue), 0 0 0 3px #d6e8fc;
}

.file-match__drop.has-file {
    min-height: 104px;
    border-style: solid;
}

.file-match__prompt {
    display: grid;
    justify-items: center;
    gap: 8px;
    text-align: center;
}

.file-match__drop-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: #e7f0fb;
    color: var(--blue-dark);
}

.file-match__up-arrow {
    transform: rotate(-90deg);
}

.file-match__drop-title,
.file-match__name {
    margin: 0;
    color: var(--navy);
    font-weight: 700;
    line-height: 1.35;
}

.file-match__hint {
    margin: 0;
    color: var(--muted);
    font-size: .8rem;
    line-height: 1.45;
}

.file-match__browse {
    min-height: 44px;
    padding: 7px 15px;
    border: 1px solid #bed2e8;
    border-radius: 7px;
    background: #fff;
    color: var(--blue-dark);
}

.file-match__browse:hover {
    border-color: var(--blue);
    background: #eef6ff;
    color: var(--blue-dark);
}

.file-match__selected {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.file-match__details {
    flex: 1 1 120px;
    min-width: 0;
}

.file-match__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-match__file-actions,
.file-match__submit {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.file-match__file-actions button {
    min-height: 44px;
    padding: 4px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--blue-dark);
    font-size: .83rem;
    font-weight: 700;
}

.file-match__file-actions button:hover:not(:disabled) {
    background: #e7f0fb;
}

.file-match__file-actions button:disabled {
    opacity: .55;
}

.file-match__submit {
    justify-content: flex-end;
    margin-top: 10px;
}

.file-match__submit .btn {
    min-width: 140px;
    min-height: 44px;
    padding: 8px 14px;
    border-radius: 8px;
}

.file-match__spinner {
    display: none;
    width: 19px;
    height: 19px;
    border: 2px solid rgb(255 255 255 / 46%);
    border-top-color: #fff;
    border-radius: 50%;
}

.file-match__form.is-busy .file-match__submit-icon {
    display: none;
}

.file-match__form.is-busy .file-match__spinner {
    display: inline-block;
    animation: spinner-border .75s linear infinite;
}

.file-match__feedback:not([data-state=""]) {
    margin-top: 12px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #f8fbff;
}

.file-match__feedback[data-state="success"] {
    border-color: #b6dfcf;
    background: #effaf5;
    color: #1b6249;
}

.file-match__feedback[data-state="error"] {
    border-color: #efd0cc;
    background: #fff5f4;
    color: #962f2b;
}

.file-match__feedback p,
.file-match__feedback ul {
    margin: 0;
    font-size: .9rem;
    line-height: 1.5;
}

.file-match__feedback ul {
    margin-top: 5px;
    padding-left: 20px;
    overflow-wrap: anywhere;
}

.file-match__feedback[data-state="success"] > p {
    font-weight: 700;
}

.file-match__next {
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid #b6dfcf;
}

.file-match__account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 9px;
}

.file-match__account-actions .btn {
    min-height: 44px;
    padding: 8px 13px;
    border-radius: 7px;
}

@media (max-width: 767.98px) {
    .file-match:has(.file-match__form:not([hidden])) {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 420px) {
    .file-match__submit .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .file-match__drop {
        transition: none;
    }

    .file-match__form.is-busy .file-match__spinner {
        animation: none;
    }
}
