/* Inquiry tracking and shared attachment previews: compact, touch-friendly. */
:root body main.portal{padding-block:20px 32px}
:root body main.portal h1{font-size:clamp(24px,3vw,36px);margin:6px 0}
:root body main.portal h2{font-size:20px;margin:8px 0}
:root body main .portal-layout.admin{gap:16px}
:root body main .portal-refresh{margin:6px 0;padding:8px 12px;min-height:44px}
:root body main #thread-meta{gap:3px 10px;margin:8px 0 12px;line-height:1.4;grid-template-columns:100px minmax(0,1fr) 100px minmax(0,1fr)}
:root body main #thread-meta dt,:root body main #thread-meta dd{min-width:0;overflow-wrap:anywhere}
:root body main .chat-timeline{gap:8px;padding:10px;max-height:65dvh}
:root body main .chat-bubble{padding:7px 10px}
:root body main .chat-text{white-space:pre-wrap!important;overflow-wrap:anywhere;line-height:1.45}
:root body main .chat-content time{margin:2px 0;white-space:normal}
:root body main .chat-attachment{display:flex;flex-direction:row;gap:4px;padding:6px 0;border-top:1px solid #0002;margin-top:6px}
:root body main .chat-attachment>small{flex-basis:100%;font-size:12px;color:#263d46}
:root body main .chat-attachment>span{white-space:normal!important;overflow-wrap:anywhere}
:root body main .chat-attachment .chat-photo-open{flex-basis:100%;padding:0;background:transparent;border:0;text-align:left}
:root body main .chat-photo-open img{width:160px;height:120px;max-width:100%;object-fit:contain;display:block;background:#fff;border-radius:6px}
:root body main .chat-message-actions{flex-wrap:wrap;gap:4px;overflow:visible}
:root body main .chat-message-actions small{font-size:11px;flex-basis:100%;color:#263d46}
:root body main .chat-composer{gap:6px!important;padding:10px!important}
:root body main .chat-composer label{margin:0;gap:3px}
:root body main .chat-composer textarea{font-size:16px;min-height:80px;height:80px;white-space:pre-wrap!important;line-height:1.45}
:root body main .chat-composer :is(p,.form-foot){margin:3px 0;white-space:normal!important}
:root body main .chat-composer .chat-upload{padding:6px;margin:0}
:root body main .chat-composer .chat-tools{margin:0}
:root body main .chat-composer .chat-tools summary,:root body main :is(.chat-message-actions,.chat-attachment,.chat-composer) button{min-height:44px;white-space:normal;font-size:14px}
:root body main .chat-composer button[hidden]{display:none!important}
.file-preview-dialog{box-sizing:border-box;width:min(960px,calc(100vw - 20px));max-height:94dvh;overflow:auto;border:1px solid #aaa;border-radius:12px;padding:14px;background:#fff;color:#111}
.file-preview-dialog::backdrop{background:#000a}
.file-preview-dialog h2{font-size:18px;line-height:1.4;margin:0 0 8px;color:#111;overflow-wrap:anywhere}
.file-preview-pane{min-width:0;max-height:70dvh;overflow:auto;background:#f2f2f2}
.file-preview-pane img{display:block;margin:auto;max-width:100%;max-height:68dvh;object-fit:contain}
.file-preview-pane iframe{width:100%;height:65dvh;border:0;display:block;background:#fff}
.file-preview-pane pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;padding:8px;color:#111}
.file-preview-dialog p{margin:6px 0;font-size:14px;color:#111}
.file-preview-actions{position:sticky;bottom:-14px;background:#fff;display:flex;justify-content:flex-end;gap:8px;padding:8px 0 max(8px,env(safe-area-inset-bottom))}
.file-preview-actions button{min-height:44px;min-width:88px;background:#ffd414;color:#111;border:1px solid #333;border-radius:6px;padding:8px 16px;font:inherit}
.file-preview-actions button:last-child{background:#111;color:#fff}
.iq-review-thumbnails{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:6px}
#iq-review .iq-preview-file{display:flex;align-items:center;gap:8px;min-width:0;white-space:normal;text-align:left}
.iq-preview-file span{overflow-wrap:anywhere}
@media(max-width:760px){
 :root body main #thread-meta{grid-template-columns:90px minmax(0,1fr)}
 :root body main .chat-timeline{padding:8px;max-height:58dvh}
 :root body main .chat-composer>[type=submit]{position:sticky;bottom:env(safe-area-inset-bottom,0px);width:100%;z-index:3;background:#ffd414!important;color:#111!important}
 .file-preview-dialog{padding:10px;margin:auto auto max(8px,env(safe-area-inset-bottom));max-height:94dvh}
 .file-preview-actions{bottom:-10px}.file-preview-actions button{flex:1}
}
:root body main .chat-attachment .chat-file-name{flex:1 1 100%;text-align:left;background:transparent;color:#14568a;border:0;text-decoration:underline;white-space:normal;overflow-wrap:anywhere;padding:2px 0}

/* Stable action icons survive locale updates and submit/edit state changes. */
[data-action-icon]::before{content:"";display:inline-block;width:1.1em;height:1.1em;flex:0 0 1.1em;vertical-align:-.15em;margin-inline-end:.4em;background:currentColor;mask:var(--action-icon) center/contain no-repeat;-webkit-mask:var(--action-icon) center/contain no-repeat}
[data-action-icon="edit"]{--action-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%2020h9%20M16.5%203.5a2.1%202.1%200%200%201%203%203L9%2017l-4%201%201-4Z%22/%3E%3C/svg%3E")}
[data-action-icon="delete"]{--action-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%206h18%20M9%206V3h6v3%20M5%206l1%2015h12l1-15%20M10%2010v7%20M14%2010v7%22/%3E%3C/svg%3E")}
[data-action-icon="preview"]{--action-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M2%2012s4-7%2010-7%2010%207%2010%207-4%207-10%207-10-7-10-7%20M15%2012a3%203%200%201%201-6%200%203%203%200%200%201%206%200%22/%3E%3C/svg%3E")}
[data-action-icon="download"]{--action-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%203v12%20m-5-5%205%205%205-5%20M4%2016v5h16v-5%22/%3E%3C/svg%3E")}
[data-action-icon="cancel"]{--action-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m6%206%2012%2012%20M18%206%206%2018%22/%3E%3C/svg%3E")}
[data-action-icon="save"]{--action-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%203h12l4%204v14H3V3Z%20M7%203v6h10V3%20M7%2021v-8h10v8%22/%3E%3C/svg%3E")}
[data-action-icon="send"]{--action-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m3%203%2018%209-18%209%204-9Z%20M7%2012h14%22/%3E%3C/svg%3E")}
[data-action-icon="link"]{--action-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m10%2013%204-4%20M8%2016l-2%202a4%204%200%200%201-6-6l4-4a4%204%200%200%201%206%200%20M14%208l2-2a4%204%200%200%201%206%206l-4%204a4%204%200%200%201-6%200%22/%3E%3C/svg%3E")}
[data-action-icon="file"]{--action-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%202h9l5%205v15H5Z%20M14%202v6h5%20M8%2013h8%20M8%2017h8%22/%3E%3C/svg%3E")}
[data-action-icon="refresh"]{--action-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M20%207v5h-5%20M4%2017v-5h5%20M6%207a7%207%200%200%201%2012-2l2%203%20M4%2016l2%203a7%207%200%200%200%2012-2%22/%3E%3C/svg%3E")}
[data-action-icon="back"]{--action-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m14%205-7%207%207%207%22/%3E%3C/svg%3E")}
[data-action-icon="next"]{--action-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m10%205%207%207-7%207%22/%3E%3C/svg%3E")}

.chat-emoji-options button::before,.chat-photo-open::before{display:none}
:root body main .chat-reply-actions{display:flex;flex-flow:row nowrap;align-items:stretch;justify-content:flex-end;gap:8px;grid-column:1/-1;min-width:0;width:100%}
:root body main .chat-reply-actions>button{display:inline-flex;align-items:center;justify-content:center;width:auto;min-width:0;min-height:44px;margin:0;padding:10px 14px;border-radius:8px;line-height:1.3;font-size:14px;word-break:keep-all;overflow-wrap:normal}
:root body main .chat-reply-actions>button[type=submit]{background:#ffd414!important;color:#111!important;border:1px solid #111}
:root body main .chat-reply-actions>button[type=button]{background:#111!important;color:#fff!important;border:1px solid #888}
@media(max-width:760px){:root body main .chat-reply-actions{position:sticky;bottom:env(safe-area-inset-bottom,0px);z-index:3;padding-block:4px}:root body main .chat-reply-actions>button{flex:1 1 0;padding:10px 8px}}
:root body main .chat-upload input::file-selector-button{background:#fff url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%3E%3Cpath%20d%3D%22M12%2016V3m-5%205%205-5%205%205M4%2015v6h16v-6%22/%3E%3C/svg%3E") 10px center/18px 18px no-repeat!important;color:#111!important;padding:10px 12px 10px 36px;min-height:44px;border:1px solid #777;border-radius:6px}

/* Photo messages: image mosaics, ordinary files remain document cards. */
:root body main .chat-photo-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px;width:min(320px,62vw);margin-top:6px;border-radius:12px;overflow:hidden}
:root body main .chat-photo-grid[data-count="1"]{grid-template-columns:minmax(0,1fr)}
:root body main .chat-photo-tile{position:relative;min-width:0;background:#e8edf0;color:#172126;border:0;padding:0}
:root body main .chat-photo-grid .chat-photo-open{display:block;position:relative;width:100%;padding:0!important;border:0!important;border-radius:0;background:transparent;min-height:130px;overflow:hidden}
:root body main .chat-photo-grid .chat-photo-open img{display:block;width:100%;height:auto;aspect-ratio:1;max-width:100%;object-fit:cover;margin:0;border-radius:0}
:root body main .chat-photo-grid[data-count="1"] img{aspect-ratio:auto;max-height:400px;object-fit:contain}
:root body main .chat-photo-status{display:block;padding:14px 10px;font-size:12px;line-height:1.4;text-align:center;color:#172126;white-space:normal}
:root body main .chat-photo-open .chat-photo-status{position:absolute;inset:0;display:grid;place-items:center;background:#e8edf0}
:root body main .chat-photo-pending{min-height:140px;display:flex;flex-direction:column;align-items:center;justify-content:center}
:root body main .chat-photo-pending::before{content:'▧';font-size:32px;color:#536575}
:root body main .chat-scan-settings{font-size:12px;color:#3e2581;text-decoration:underline;padding:6px}
:root body main .chat-photo-tile>small{display:block;font-size:11px;padding:3px;color:#172126;overflow-wrap:anywhere}
.file-preview-actions{flex-wrap:wrap;align-items:center}
.file-preview-pane img{cursor:zoom-in}.file-preview-pane img.photo-zoomed{max-width:none;max-height:none;cursor:zoom-out}
@media(max-width:480px){.file-preview-actions button{min-width:64px;padding:8px;flex:1 1 auto}}
