.att-tray { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 0; }
.field .att-tray { padding: 8px 0 0; }
.att-chip {
  position: relative; display: inline-flex; align-items: center; gap: 8px; max-width: 260px; height: 40px; padding: 0 4px 0 4px;
  border-radius: 9px; border: 1px solid var(--border-2); background: var(--surface); overflow: hidden; animation: fade-in 160ms;
}
.att-chip.is-error { border-color: var(--danger); background: var(--danger-soft); }
.att-chip-thumb { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface-3); }
.att-chip-ic { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.att-chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.att-chip-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-chip-sub { font-size: 11px; color: var(--text-3); }
.att-chip.is-error .att-chip-sub { color: var(--danger); }
.att-chip-x { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--text-3); }
.att-chip-x:hover { background: var(--hover); color: var(--text); }
.att-chip-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: calc(var(--p, 0) * 100%); background: var(--accent); transition: width 120ms linear; }
.att-btn { width: 28px; height: 28px; }
.label-row { display: flex; align-items: center; justify-content: space-between; }
.label-row .att-btn { width: 24px; height: 24px; margin: -4px -2px -4px 0; }
.composer-foot .att-btn { margin-right: 2px; }
.composer.is-dragover, textarea.is-dragover, .opt-row.is-dragover { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-ring); background: var(--accent-soft); }
#composer-send.is-waiting { opacity: .7; }

.att-block { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 14px; }
.decision-card .att-block, .dc-opt .att-block { padding: 0; }
.att-media { display: flex; flex-wrap: wrap; gap: 8px; }
.att-thumb { padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-3); cursor: zoom-in; transition: transform 140ms var(--ease), box-shadow 140ms; }
.att-thumb:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.att-thumb img { display: block; width: 280px; height: 158px; max-width: 100%; object-fit: cover; }
.dc-opt .att-thumb img { width: 180px; height: 102px; }
.att-video { display: block; width: min(100%, 640px); aspect-ratio: 16 / 9; max-height: 360px; border-radius: 10px; background: #000; border: 1px solid var(--border); }
.att-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.att-file {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); text-decoration: none; min-width: 0; transition: border-color var(--t), background var(--t);
}
.att-file:hover { border-color: var(--border-2); background: var(--surface); }
.att-file-ic { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-fg); }
.att-file-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.att-file-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file-sub { font-size: 11.5px; color: var(--text-3); }
.att-file-dl { color: var(--text-3); }
.att-file:hover .att-file-dl { color: var(--accent-fg); }
.md img[data-lightbox] { cursor: zoom-in; border-radius: 8px; border: 1px solid var(--border); max-height: 420px; }
.md .att-video { margin: 4px 0; }
.att-missing { display: inline-flex; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-3); font-size: 12px; }
.tr-atts { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; }

.lightbox { width: min(1200px, 96vw); background: #0d0d0c; color: #eee; overflow: hidden; }
.modal-backdrop:has(.lightbox) { padding: 3vh 2vw; background: rgb(0 0 0 / .78); align-items: center; }
.lb-stage { display: grid; place-items: center; min-height: 200px; max-height: 84vh; background: #0d0d0c; }
.lb-img { display: block; max-width: 100%; max-height: 84vh; object-fit: contain; }
.lb-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 16px; border-top: 1px solid rgb(255 255 255 / .08); font-size: 13px; }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-count { color: rgb(255 255 255 / .5); margin-right: 6px; }
.lb-bar .icon-btn { color: rgb(255 255 255 / .7); }
.lb-bar .icon-btn:hover { background: rgb(255 255 255 / .1); color: #fff; }
.i.flip { transform: scaleX(-1); }

.opt-row { grid-template-columns: 22px minmax(0, 1fr) auto auto auto; }
.opt-row .att-btn { margin-top: 2px; }
.opt-tray { grid-column: 2 / -1; padding: 0; }

@media (max-width: 820px) {
  .att-thumb img { max-width: 100%; }
  .att-files { grid-template-columns: minmax(0, 1fr); }
  .opt-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .opt-tray { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .opt-row .att-btn { grid-column: 2; grid-row: 1; }
  .opt-row .opt-del { grid-column: 3; grid-row: 1; }
}
