.attachment-field-group .attachment-file-input,
.status-attachment-field .attachment-file-input {
    padding: 0;
    min-height: 46px;
    overflow: hidden;
    cursor: pointer;
}

.attachment-file-input::file-selector-button {
    min-height: 44px;
    margin: 0 0 0 10px;
    padding: 0 16px;
    border: 0;
    border-inline-end: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}

[dir="ltr"] .attachment-file-input::file-selector-button {
    margin: 0 10px 0 0;
}

.attachment-file-input:hover::file-selector-button {
    background: color-mix(in srgb, var(--primary) 8%, var(--surface-muted));
    color: var(--primary);
}

.field-help,
.status-attachment-field > small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.attachment-selection {
    min-height: 0;
    margin-top: 7px;
    color: var(--text);
    font-size: 12px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.attachment-selection:empty { display: none; }

.status-attachment-field {
    display: grid;
    gap: 7px;
    margin-top: 2px;
}

.status-attachment-field > label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.attachments-panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.attachments-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.attachments-panel__head h3 {
    margin: 3px 0 0;
    font-size: 17px;
}

.attachments-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    margin-inline-start: 5px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    vertical-align: middle;
}

.attachments-list { display: grid; gap: 8px; }

.attachment-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    min-height: 58px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-muted);
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, opacity 180ms ease;
}

.attachment-item:hover {
    border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
    background: color-mix(in srgb, var(--primary) 3%, var(--surface-muted));
}

.attachment-item.is-new-attachment { animation: attachment-enter 220ms ease-out both; }

.attachment-item__icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    color: var(--primary);
}

.attachment-item__icon svg,
.attachment-download svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.attachment-item__body { min-width: 0; }
.attachment-item__body strong,
.attachment-item__body small { display: block; }
.attachment-item__body strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13.5px;
}
.attachment-item__body small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11.5px;
}

.attachment-download {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}
.attachment-download:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }

@keyframes attachment-enter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
    .attachment-file-input { font-size: 16px; }
    .attachment-file-input::file-selector-button {
        min-height: 46px;
        padding-inline: 13px;
        font-size: 14px;
    }
    .attachments-panel { margin-top: 14px; padding-top: 14px; }
    .attachment-item { grid-template-columns: 36px minmax(0, 1fr) 40px; padding: 9px; }
    .attachment-item__icon { width: 36px; height: 36px; }
    .attachment-download {
        width: 40px;
        height: 40px;
        min-height: 40px;
        justify-content: center;
        padding: 0;
    }
    .attachment-download span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .attachment-item,
    .attachment-item.is-new-attachment {
        animation: none !important;
        transition-duration: 1ms !important;
    }
}
