/* Compact private receipts with an accessible two-column preview.
   All rules are scoped to the attachment module. */
.attachment-panel{min-width:0;}
.attachment-heading{display:flex;align-items:center;gap:10px;}
.attachment-heading h3{margin-bottom:4px;}
.attachment-count{display:inline-grid;place-items:center;min-width:24px;height:24px;padding:0 5px;border:1px solid #cbd7c8;border-radius:999px;color:#47634a;font-size:12px;font-weight:700;background:#eff4ed;}
.attachment-list{list-style:none;padding:0;margin:12px 0 18px;border:1px solid var(--border,#d7dcd5);border-radius:8px;overflow:hidden;}
.attachment-list-item{margin:0;padding:0!important;list-style:none;}
.attachment-list-item+.attachment-list-item{border-top:1px solid var(--border,#e0e3df);}
.attachment-open{display:flex;align-items:center;gap:12px;min-height:58px;padding:9px 14px;color:inherit;text-decoration:none;background:#fff;transition:background .15s ease;}
.attachment-open:hover,.attachment-open:focus-visible{background:#f2f6f0;}
.attachment-open:focus-visible{outline:2px solid #4c7958;outline-offset:-3px;}
.attachment-file-info{display:flex;flex-direction:column;gap:3px;flex:1;min-width:0;}
.attachment-filename{font-weight:650;font-size:14px;overflow-wrap:anywhere;line-height:1.3;}
.attachment-secondary{font-size:12px;color:#59665b;line-height:1.3;}
.attachment-view-hint{font-size:13px;font-weight:600;color:#436a4c;white-space:nowrap;margin-left:auto;}

.attachment-preview-dialog{position:fixed;inset:0;margin:auto;padding:0;border:1px solid #c9d1c6;border-radius:12px;width:min(1100px,calc(100vw - 36px));max-width:none;height:min(790px,calc(100dvh - 36px));max-height:none;box-sizing:border-box;box-shadow:0 25px 80px rgba(20,32,23,.26);background:#fff;color:#243126;overflow:hidden;}
.attachment-preview-dialog[open]{display:flex;flex-direction:column;}
.attachment-preview-dialog::backdrop{background:rgba(16,24,18,.64);}
.attachment-preview-header{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;gap:14px;padding:13px 18px;border-bottom:1px solid #dce3dc;background:#f9faf8;min-width:0;}
.attachment-preview-heading{min-width:0;}
.attachment-preview-heading h3{margin:0;font-size:16px;line-height:1.4;overflow-wrap:anywhere;}
.attachment-preview-heading p{margin:3px 0 0;font-size:12px;}


.attachment-preview-layout{display:grid;grid-template-columns:minmax(255px,300px) minmax(0,1fr);flex:1 1 auto;min-height:0;min-width:0;}
.attachment-preview-sidebar{display:flex;flex-direction:column;min-height:0;min-width:0;overflow-y:auto;padding:20px 18px;gap:14px;background:#fff;border-right:1px solid #dce3dc;box-sizing:border-box;}
.attachment-preview-sidebar h4{margin:0;font-size:14px;}
.attachment-detail-list{display:grid;gap:10px;margin:0;padding:0 0 15px;border-bottom:1px solid #e4e9e3;}
.attachment-detail-list>div{display:grid;grid-template-columns:1fr;gap:2px;}
.attachment-detail-list dt{font-size:11px;font-weight:700;color:#667366;}
.attachment-detail-list dd{margin:0;font-size:13px;color:#263b2b;overflow-wrap:anywhere;}

.attachment-preview-sidebar form.attachment-rename-form{display:flex;flex-direction:column;gap:8px;min-width:0;margin:0;padding:0;background:transparent;border:0;box-shadow:none;}
.attachment-rename-form label{font-size:12px;font-weight:700;color:#455449;}
.attachment-rename-form input{box-sizing:border-box;width:100%;min-width:0;min-height:42px;margin:0;padding:8px 10px;border:1px solid #cdd9cf;border-radius:6px;font:inherit;}
.attachment-rename-form button{align-self:flex-start;margin:0;}
.attachment-rename-form button:where(:not(button[data-button-role])){min-height:40px;}
.attachment-rename-hint{font-size:11px;color:#687269;}
.attachment-preview-actions{display:flex;flex-wrap:wrap;align-items:center;gap:9px;margin-top:auto;padding-top:16px;border-top:1px solid #e0e5e0;}
.attachment-preview-actions :is(button,a){display:inline-flex;box-sizing:border-box;align-items:center;justify-content:center;margin:0;}
.attachment-preview-actions :is(button,a):where(:not(button[data-button-role])){min-height:42px;padding:9px 14px;white-space:nowrap;text-decoration:none;}
.attachment-preview-actions form{display:inline-flex;margin:0;padding:0;border:0;background:transparent;box-shadow:none;}
.attachment-preview-actions .attachment-close-text{margin-left:auto;}

.attachment-preview-stage{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;overflow:hidden;padding:14px;box-sizing:border-box;background:#e9ebe8;}
/* Both axes constrained: portrait photos always fit without scrolling. */
.attachment-preview-stage img{display:block;width:100%;height:100%;min-width:0;min-height:0;max-width:100%;max-height:100%;object-fit:contain;}
.attachment-preview-stage [hidden]{display:none!important;}

@media(max-width:700px){
  .attachment-preview-dialog{width:calc(100vw - 12px);height:calc(100dvh - 16px);border-radius:9px;}
  .attachment-preview-header{padding:10px 12px;}
  .attachment-preview-layout{display:flex;flex-direction:column;}
  .attachment-preview-stage{order:1;flex:1 1 55%;min-height:180px;padding:8px;}
  .attachment-preview-sidebar{order:2;flex:0 1 auto;max-height:42dvh;overflow-y:auto;border-right:0;border-top:1px solid #dce3dc;padding:12px;gap:10px;}
  .attachment-detail-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding-bottom:8px;}
  .attachment-preview-actions{margin-top:0;padding-top:10px;}
  .attachment-rename-form button:where(:not(button[data-button-role])){min-height:44px;}
  .attachment-open{padding:8px 10px;gap:9px;}
}

.attachment-link-form{display:flex;flex-direction:column;gap:8px;padding:12px 0;border-top:1px solid #dde4dc;background:transparent;}
.attachment-link-form select{width:100%;min-height:42px;}
.attachment-link-form button{align-self:flex-start;}
