.att-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.att-btn {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    color: var(--zinc-500);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-std), color var(--dur-fast) var(--ease-std);
}

.att-btn:hover { background: var(--zinc-100); color: var(--ink-900); }
.att-btn:active { scale: 0.9; }
.att-btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.att-btn:has(~ .att-input:focus-visible) { outline: 2px solid var(--signal-500); outline-offset: 2px; }
.dash .att-btn:has(~ .att-input:focus-visible) { outline-color: var(--accent); }
.att-btn-glyph { width: 1.125rem; height: 1.125rem; }

.att-pending {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0 1rem 0.5rem;
}

.att-pending--dash { padding: 0 0 8px; }
.att-pending--form { padding: 0.25rem 0 0; }

.att-form-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    color: var(--zinc-500);
    font-size: var(--text-xs);
}

.att-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    max-width: 100%;
    padding: 0.3rem 0.5rem 0.3rem 0.6rem;
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-chip);
    background: var(--zinc-50);
    color: var(--ink-800);
    font-size: var(--text-xs);
    line-height: 1.2;
}

.att-chip--pending { border-style: dashed; background: transparent; }

.att-chip-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.att-chip-link:hover .att-chip-name { text-decoration: underline; }

.att-chip-glyph { width: 0.95rem; height: 0.95rem; flex-shrink: 0; color: var(--zinc-500); }

.att-chip-glyph--busy { animation: att-spin 0.9s linear infinite; }

@keyframes att-spin {
    to { transform: rotate(1turn); }
}

.att-chip-name {
    min-width: 0;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.att-chip-size { color: var(--zinc-500); white-space: nowrap; }

.att-chip-remove,
.att-remove {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--zinc-500);
    cursor: pointer;
}

.att-chip-remove:hover,
.att-remove:hover { background: var(--rose-50); color: var(--rose-600); }
.att-chip-remove--confirm,
.att-chip-remove--confirm:hover,
.att-remove--confirm,
.att-remove--confirm:hover { background: var(--rose-600); color: #fff; }
.att-chip-remove:disabled { opacity: 0.4; pointer-events: none; }
.att-chip-remove-glyph,
.att-remove-glyph { width: 0.75rem; height: 0.75rem; }

.att-error {
    flex-basis: 100%;
    min-width: 0;
    margin: 0;
    font-size: var(--text-xs);
    color: var(--rose-600);
    overflow-wrap: anywhere;
}

.att-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

.att-list--mine { align-items: flex-end; }

.att-grid {
    display: grid;
    gap: 0.375rem;
    grid-template-columns: repeat(var(--att-cols, 2), minmax(0, 10rem));
}

.att-grid--1 { --att-cols: 1; }
.att-grid--2 { --att-cols: 2; }
.att-grid--3 { --att-cols: 3; }

.att-thumb {
    position: relative;
    margin: 0;
    min-width: 0;
}

.att-thumb-link {
    display: block;
    width: 100%;
    padding: 0;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 10px;
    border: 1px solid var(--zinc-200);
    background: var(--zinc-100);
    cursor: pointer;
}

.att-thumb-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: scale var(--dur-fast) var(--ease-std);
}

.att-thumb-link:hover .att-thumb-img { scale: 1.03; }

.att-grid--1 {
    grid-template-columns: minmax(0, auto);
    max-width: var(--att-one-w, 17rem);
}

.att-grid--1 .att-thumb-link {
    width: auto;
    aspect-ratio: auto;
    max-width: 100%;
}

.att-grid--1 .att-thumb-img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: var(--att-one-h, 15rem);
    object-fit: contain;
}

.att-uploading-note {
    font-size: var(--text-2xs);
    color: var(--zinc-500);
}

.att-pending .att-uploading-note { flex-basis: 100%; }

.att-dropping {
    outline: 2px dashed var(--signal-500);
    outline-offset: 2px;
    border-radius: var(--radius-control);
}

.att-thumb .att-remove {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    width: 1.5rem;
    height: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink-800);
    box-shadow: var(--shadow-card);
}

.dash .att-thumb .att-remove {
    background: rgba(0, 0, 0, .82);
    color: var(--dash-text);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 2px 6px rgba(0, 0, 0, .45);
}

.dash .att-thumb .att-remove:hover {
    background: rgba(0, 0, 0, .92);
    color: var(--dash-danger);
}

.dash .att-thumb .att-remove--confirm,
.dash .att-thumb .att-remove--confirm:hover {
    background: var(--dash-danger);
    color: #2a0a0a;
}

.dash .bubble--user .att-chip { color: var(--ink-800); }

@media (max-width: 40rem) {
    .att-grid { grid-template-columns: repeat(var(--att-cols, 2), minmax(0, 7.5rem)); }
    .att-grid--1 { grid-template-columns: minmax(0, auto); --att-one-w: 13rem; --att-one-h: 11rem; }
    .att-chip-name { max-width: 9rem; }
}


.att-viewer {
    position: fixed;
    inset: 0;
    z-index: var(--z-top);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 27, 45, 0.94);
}

.dash ~ .att-viewer {
    background: rgba(0, 0, 0, 0.94);
}

.att-viewer:focus-visible { outline: none; }

.att-viewer-meta {
    position: absolute;
    top: 1.125rem;
    left: 1.375rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    max-width: calc(100% - 9rem);
}

.att-viewer-name {
    font-size: var(--text-xs);
    font-weight: 500;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.att-viewer-size {
    font-size: var(--text-2xs);
    color: rgba(255, 255, 255, 0.55);
}

.att-viewer-tools {
    position: absolute;
    top: 1rem;
    right: 1.125rem;
    display: flex;
    gap: 0.5rem;
}

.att-viewer-btn,
.att-viewer-step {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-std);
}

.att-viewer-btn { width: 2.25rem; height: 2.25rem; }

.att-viewer-btn:hover,
.att-viewer-step:hover { background: rgba(255, 255, 255, 0.22); }

.att-viewer-glyph { width: 1.125rem; height: 1.125rem; }

.att-viewer-step {
    position: absolute;
    top: 50%;
    width: 2.625rem;
    height: 2.625rem;
    transform: translateY(-50%);
}

.att-viewer-step--prev { left: 1.5rem; }
.att-viewer-step--next { right: 1.5rem; }

.att-viewer-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    overflow: auto;
}

.att-viewer-img {
    display: block;
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    cursor: zoom-in;
}

.att-viewer-img--actual {
    max-width: none;
    max-height: none;
    cursor: zoom-out;
}

.att-viewer-count {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    padding: 0.3125rem 0.875rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    font-size: var(--text-2xs);
    font-weight: 600;
    color: #fff;
}

@media (max-width: 40rem) {
    .att-viewer-step--prev { left: 0.5rem; }
    .att-viewer-step--next { right: 0.5rem; }
    .att-viewer-meta { max-width: calc(100% - 7rem); }
}
