.drive-dialog{width:min(720px,calc(100vw - 24px))}
.drive-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.drive-toolbar small{color:var(--muted)}
.drive-loading,.drive-empty{padding:30px;text-align:center;color:var(--muted)}
.drive-files{display:grid;gap:7px;max-height:56vh;overflow:auto}
.drive-file{width:100%;display:flex;align-items:center;gap:13px;text-align:left;padding:12px 14px;border:1px solid var(--line);border-radius:9px;background:#fbfcf9;color:var(--ink)}
.drive-file:hover{background:#edf2e9;border-color:#cbd7c8}
.drive-file-icon{font-size:22px;color:var(--green);width:28px;text-align:center}
.drive-file-info{display:flex;flex-direction:column;gap:4px;min-width:0;flex:1}
.drive-file-info strong,.drive-file-info small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.drive-file-info small{color:var(--muted)}
.drive-file-action{color:var(--green);font-weight:700;font-size:11px}
.attachment-actions{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}.attachment-actions button{font-size:10px;padding:9px 11px}.upload-status{margin:10px 0;padding:10px;border:1px solid var(--line);border-radius:8px;background:#f7f9f5}.upload-status>div{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:10px}.upload-status progress{width:100%;height:8px;margin-top:8px;accent-color:var(--green)}.drive-card{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px}.drive-card-info{display:grid;gap:4px;min-width:0}.drive-card-info strong,.drive-card-info small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.drive-card-info small{color:var(--muted);font-size:9px}.drive-card-actions{display:flex;align-items:center;gap:5px;flex-wrap:wrap;justify-content:flex-end}.drive-card-actions .outline{padding:6px 8px;font-size:9px;text-decoration:none}.project-drive-actions{display:flex;align-items:center;gap:10px;padding:10px 0 16px}.project-drive-actions .helper{margin:0}.project-drive-actions a{text-decoration:none}
@media(max-width:760px){.attachment-heading{align-items:flex-start;gap:10px}.attachment-actions{width:100%;justify-content:stretch}.attachment-actions button{flex:1}.drive-card{grid-template-columns:auto minmax(0,1fr)}.drive-card-actions{grid-column:1/-1;justify-content:flex-start;padding-left:38px}.comment-link-row .attachment-actions{display:grid;grid-template-columns:1fr 1fr}}
.file-preview-dialog{width:min(960px,calc(100vw - 24px));padding:18px}.preview-fallback{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:10px;color:var(--muted);font-size:10px}.preview-fallback a{text-decoration:none;white-space:nowrap}
.drive-inline-preview{grid-column:1/-1;margin-top:4px;border-top:1px solid var(--line);padding-top:10px}.drive-secure-preview{display:grid;place-items:center;width:100%;min-height:230px;border-radius:8px;background:#eef1eb;overflow:hidden}.drive-secure-preview img,.drive-secure-preview video,.drive-secure-preview iframe{display:block;width:100%;height:auto;max-height:520px;object-fit:contain;border:0;background:#111}.drive-secure-preview iframe{height:clamp(300px,42vw,560px);background:#fff}.drive-secure-preview audio{width:min(100%,560px);margin:28px}.drive-preview-state{display:flex;flex-direction:column;align-items:center;gap:8px;padding:24px;text-align:center}.drive-preview-state .drive-preview-help{max-width:480px}.drive-preview-help{display:block;margin-top:6px;color:var(--muted);font-size:8px;line-height:1.5}.file-preview-dialog #file-preview-content{min-height:260px}.drive-secure-preview.compact{min-height:clamp(300px,55vh,620px)}
@media(max-width:760px){.drive-secure-preview{min-height:210px}.drive-secure-preview img,.drive-secure-preview video{max-height:70vh}.drive-secure-preview iframe{height:65vh;min-height:320px}.drive-secure-preview.compact{min-height:55vh}}

/* R2 media uses the same measured preview surface on desktop and mobile. */
.comment,.attachment-row,.drive-card-info,.file-preview-dialog,#file-preview-content{min-width:0;max-width:100%}
.drive-inline-preview{min-width:0;overflow:hidden}
.drive-secure-preview.r2-preview{min-height:0;max-width:100%;max-height:min(72vh,720px)}
.drive-secure-preview.r2-preview>img,.drive-secure-preview.r2-preview>video{display:block;width:100%;max-width:100%;height:auto;max-height:min(72vh,720px);object-fit:contain;background:#111}
.drive-secure-preview.r2-preview>audio{display:block;width:min(100%,560px);max-width:100%;margin:28px auto}
.drive-secure-preview.r2-preview>iframe{display:block;width:100%;max-width:100%;height:min(70vh,680px);border:0;background:#fff}
.file-preview-dialog{overflow-x:hidden}.file-preview-dialog #file-preview-content{overflow:hidden}.file-preview-dialog .drive-secure-preview.r2-preview{width:100%}
.drive-card-info strong{overflow-wrap:anywhere}.drive-card-actions{min-width:0}.drive-card-actions a,.drive-card-actions button{max-width:100%}
@media(max-width:760px){
 .file-preview-dialog{width:calc(100vw - 16px);max-height:calc(100dvh - 16px);padding:12px;margin:auto}
 .file-preview-dialog .modal-head{margin-bottom:10px}.file-preview-dialog .modal-head h2{font-size:17px;overflow-wrap:anywhere}
 .file-preview-dialog #file-preview-content{max-height:calc(100dvh - 150px);overflow:auto;border-radius:8px}
 .drive-secure-preview.r2-preview{width:100%;max-height:calc(100dvh - 165px);border-radius:7px}
 .drive-secure-preview.r2-preview>img,.drive-secure-preview.r2-preview>video{max-height:calc(100dvh - 165px)}
 .drive-secure-preview.r2-preview>iframe{height:calc(100dvh - 180px);min-height:360px}
 .drive-inline-preview .drive-secure-preview.r2-preview{max-height:58vh}
 .drive-inline-preview .drive-secure-preview.r2-preview>img,.drive-inline-preview .drive-secure-preview.r2-preview>video{max-height:58vh}
 .drive-card{width:100%;grid-template-columns:28px minmax(0,1fr)}
 .drive-card-actions{grid-column:1/-1;padding-left:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
 .drive-card-actions .outline,.drive-card-actions .attachment-remove{width:100%;text-align:center;justify-content:center;white-space:normal}
 .preview-fallback{align-items:stretch;flex-direction:column}.preview-fallback a{text-align:center}
}
@media(max-width:380px){.drive-card-actions{grid-template-columns:1fr}.file-preview-dialog{width:calc(100vw - 8px);padding:10px}}
