﻿/* Images never determine the size of the surrounding publication or message. */
html:root .content-files { display:grid; gap:10px; min-width:0; }
html:root .image-gallery { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; width:min(100%,520px); }
html:root .image-gallery-single { grid-template-columns:minmax(0,1fr); width:min(100%,360px); }
html:root button.image-thumbnail { position:relative; padding:0; width:100%; min-width:0; border:0; border-radius:14px; overflow:hidden; background:var(--surface-active); color:var(--text-primary); cursor:zoom-in; box-shadow:none; }
html:root .image-thumbnail img { display:block; width:100%; height:190px; max-width:100%; object-fit:contain; }
html:root .image-gallery-single img { height:240px; }
html:root .image-thumbnail:hover { background:var(--accent-soft); }
html:root .image-thumbnail:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
html:root .content-document { padding:10px 12px; border-radius:10px; background:var(--surface-active); overflow-wrap:anywhere; }
html:root :is(#news-file-selection,#task-file-selection,#chat-image-selection,.news-edit-image-selection) { display:flex; flex-wrap:wrap; gap:10px; }
html:root .pending-image { display:flex; align-items:center; gap:8px; max-width:100%; padding:7px; background:var(--surface-active); border-radius:12px; font-size:.74rem; overflow-wrap:anywhere; }
html:root .pending-image img { width:62px; height:52px; object-fit:contain; border-radius:7px; flex-shrink:0; }
html:root .chat-message .content-files { margin:10px 0; max-width:100%; grid-column:2; }
html:root .chat-message .image-gallery { width:min(100%,420px); }
html:root .chat-image-fields { margin:8px 0; }
html:root .image-viewer-backdrop { position:fixed; inset:0; z-index:220; display:grid; place-items:center; padding:20px; background:rgb(8 14 22 / .76); backdrop-filter:blur(8px); }
html:root .image-viewer { width:min(1180px,100%); height:min(850px,calc(100dvh - 40px)); display:flex; flex-direction:column; background:var(--surface); color:var(--text-primary); border-radius:22px; box-shadow:var(--shadow-dropdown); overflow:hidden; }
html:root .image-viewer-header { display:flex; align-items:center; gap:18px; padding:14px 20px; flex-shrink:0; border-bottom:1px solid var(--border); }
html:root .image-viewer-title { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.95rem; }
html:root .image-viewer-counter { white-space:nowrap; font-size:.8rem; color:var(--text-secondary); }
html:root .image-viewer-download { font-size:.8rem; }
html:root .image-viewer-close { width:42px; height:42px; padding:0; border:0; font-size:1.8rem; border-radius:50%; background:var(--surface-active); color:var(--text-primary); }
html:root .image-viewer-stage { position:relative; flex:1; min-height:0; display:flex; align-items:center; justify-content:center; padding:16px 60px; touch-action:pan-y; }
html:root .image-viewer-image { width:100%; height:100%; object-fit:contain; min-height:0; }
html:root .image-viewer-arrow { position:absolute; top:calc(50% - 25px); width:46px; height:50px; padding:0; border:0; border-radius:14px; background:var(--surface-active); color:var(--text-primary); font-size:2rem; }
html:root .image-viewer-previous { left:10px; } html:root .image-viewer-next { right:10px; }
html:root .image-viewer-status { margin:0; padding:0 20px 10px; font-size:.82rem; } html:root .image-viewer-status:empty { display:none; }
html:root .image-viewer > button { align-self:center; margin:0 0 12px; }
body.image-viewer-open { overflow:hidden; }
html:root .content-delete-popover { position:fixed; z-index:210; width:min(270px,calc(100vw - 24px)); padding:18px; background:var(--surface); color:var(--text-primary); border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow-dropdown); }
html:root .content-delete-actions { display:flex; gap:8px; margin-top:14px; } html:root .content-delete-actions button { flex:1; min-height:42px; padding:8px 12px; font-size:.82rem; }
html:root .content-delete-yes { background:var(--danger,#b33e35); color:#fff; border-color:transparent; } html:root .content-delete-popover p { margin:12px 0 0; font-size:.8rem; overflow-wrap:anywhere; }
html:root .news-post { border:0; }
html:root :is(#news-body,.news-inline-editor textarea) { border:0; outline:0; box-shadow:none; resize:vertical; background:transparent; }
html:root :is(#news-body,.news-inline-editor textarea):focus { border:0; outline:0; box-shadow:none; background:var(--surface-active); }
html:root .news-inline-editor { border:0; margin-left:var(--feed-indent); padding:0; }
html:root .news-inline-editor > label:first-child { font-size:.76rem; color:var(--text-secondary); }
html:root .news-inline-editor textarea { padding:12px 0; line-height:1.65; font-weight:400; }
html:root .news-inline-editor > :is(button,.news-edit-actions) { margin-top:10px; }
html:root .news-inline-editor .news-edit-image-selection { margin:12px 0; }
@media(max-width:600px) {
  html:root .image-viewer-backdrop { padding:8px; } html:root .image-viewer { height:calc(100dvh - 16px); border-radius:16px; }
  html:root .image-viewer-header { gap:10px; padding:12px; flex-wrap:wrap; }
  html:root .image-viewer-title { flex-basis:calc(100% - 65px); order:0; } html:root .image-viewer-close { order:1; }
  html:root :is(.image-viewer-counter,.image-viewer-download) { order:2; }
  html:root .image-viewer-stage { padding:8px 44px; } html:root .image-viewer-arrow { width:38px; }
  html:root .image-viewer-previous { left:3px; } html:root .image-viewer-next { right:3px; }
  html:root .image-thumbnail img { height:145px; } html:root .image-gallery-single img { height:190px; }
}
html[data-theme="macos"] .image-viewer-close { order:-1; display:grid; place-items:center; background:transparent; font-size:0; }
html[data-theme="macos"] .image-viewer-close::before { content:''; width:15px; height:15px; border-radius:50%; border:1px solid #d1453b; background:#ff5f57; }

/* Shared attachment picker: actual local actions, comfortable targets in every theme. */
html:root :is(#news-file-selection,#task-file-selection,#chat-image-selection,.news-edit-image-selection).file-upload-panel { display:block; width:100%; min-width:0; }
html:root .file-upload-panel { padding:18px; background:var(--surface-active); border-radius:16px; color:var(--text-primary); }
html:root .attachment-cards { display:flex; flex-wrap:wrap; gap:16px; padding-bottom:18px; margin-bottom:18px; border-bottom:1px solid var(--border); }
html:root .pending-image.attachment-card { display:block; position:relative; width:148px; height:142px; padding:5px; background:var(--surface); border-radius:16px; box-shadow:0 2px 5px #00000012; animation:crm-page-in 200ms var(--motion-ease); }
html:root button.attachment-preview { display:flex; flex-direction:column; align-items:center; justify-content:center; position:relative; width:100%; height:100%; padding:0; border:0; border-radius:12px; background:transparent; color:var(--text-secondary); box-shadow:none; overflow:hidden; }
html:root .attachment-preview img { width:100%; height:100%; object-fit:cover; border-radius:12px; }
html:root .attachment-preview > svg { width:40px; height:40px; color:var(--accent); margin:7px; }
html:root .attachment-name { display:block; padding:5px 8px; width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.72rem; }
html:root .attachment-extension { font-size:.7rem; letter-spacing:.05em; }
html:root :is(.attachment-remove,.attachment-more) { position:absolute; top:0; width:36px; height:32px; display:grid; place-items:center; padding:5px; border:0; background:var(--surface); color:var(--text-secondary); box-shadow:0 2px 5px #00000012; opacity:0; transition:opacity 160ms ease,background 160ms ease; }
html:root .attachment-remove { left:0; border-radius:15px 0 12px 0; }
html:root .attachment-more { right:0; border-radius:0 15px 0 12px; opacity:.85; }
html:root :is(.attachment-remove,.attachment-more) svg { width:22px; height:22px; }
html:root .attachment-card:is(:hover,:focus-within) :is(.attachment-remove,.attachment-more) { opacity:1; }
html:root .attachment-remove:hover { color:var(--danger,#bd3a35); background:var(--surface-active); }
html:root .attachment-upload-actions { display:grid; grid-template-columns:148px minmax(0,1fr); align-items:stretch; gap:18px; }
html:root .attachment-upload-column { display:flex; flex-direction:column; align-items:stretch; gap:10px; min-width:0; }
html:root .attachment-upload-column > button.secondary { width:100%; margin:0; padding:10px 8px; font-size:.8rem; }
html:root button.attachment-upload-tile { display:flex; flex-direction:column; justify-content:center; align-items:center; gap:16px; width:148px; height:132px; border:0; border-radius:16px; background:var(--surface); color:var(--text-secondary); font-size:.82rem; font-weight:400; box-shadow:0 2px 5px #00000012; transition:transform 180ms ease,box-shadow 180ms ease; }
html:root .attachment-upload-tile svg { width:36px; height:36px; color:var(--accent); }
html:root .attachment-upload-tile:hover:not(:disabled) { transform:translateY(-2px); box-shadow:0 6px 16px #00000016; }
html:root .attachment-limit { font-size:.75rem; color:var(--text-secondary); }
html:root .attachment-drop-zone { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; min-width:0; margin:0; padding:18px; border:2px dashed var(--border); border-radius:12px; color:var(--text-secondary); font-size:.8rem; transition:background 180ms ease,border-color 180ms ease; }
html:root .attachment-drag-over { border-color:var(--accent); background:var(--accent-soft); }
html:root .attachment-feedback { color:var(--danger,#bd3a35); margin:8px 0 0; font-size:.78rem; font-weight:400; }
html:root .attachment-feedback:empty { display:none; }
html:root .composer-tool-button { display:inline-flex; align-items:center; gap:6px; }
html:root .composer-tool-button > svg { width:20px; height:20px; }
html:root .attachment-count { display:inline-grid; place-items:center; font-size:.62rem; line-height:1; border-radius:50%; background:var(--text-secondary); color:var(--surface); min-width:17px; height:17px; padding:2px; }
html:root .attachment-menu { position:fixed; z-index:320; padding:16px 12px 10px; background:var(--surface); color:var(--text-primary); border:1px solid var(--border); border-radius:20px; box-shadow:0 16px 45px #00000029; max-height:calc(100dvh - 24px); overflow-y:auto; }
html:root .attachment-menu-name { display:block; padding:0 10px; font-size:.84rem; overflow-wrap:anywhere; }
html:root .attachment-menu-size { padding:10px; margin:0 0 5px; color:var(--text-secondary); font-size:.76rem; border-bottom:1px solid var(--border); }
html:root button.attachment-menu-action { width:100%; display:flex; justify-content:space-between; align-items:center; min-height:44px; padding:10px; border:0; border-radius:9px; box-shadow:none; background:transparent; color:var(--text-primary); text-align:left; font-weight:400; font-size:.87rem; }
html:root .attachment-menu-action:hover { background:var(--surface-active); }
html:root .attachment-menu-action > span:last-child { color:var(--text-secondary); font-size:1.2rem; }
html:root button.attachment-menu-delete,html:root .attachment-menu-delete > span:last-child { color:var(--danger,#bd3a35); }
html:root .attachment-rename { padding:10px; display:grid; gap:12px; }
html:root .attachment-rename label { font-size:.8rem; }
html:root .news-image-picker-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:0 6px 12px; font-size:.9rem; }
html:root .news-image-picker-grid { display:flex; flex-wrap:wrap; gap:12px; margin-bottom:16px; }
html:root .news-image-picker-grid .attachment-card { width:calc(33.333% - 8px); height:110px; min-width:0; }
html:root .news-image-picker > button { max-width:100%; }
html:root .mini-album { display:flex; align-items:center; flex-wrap:wrap; gap:8px; width:100%; }
html:root button.mini-album-title { background:transparent; border:0; box-shadow:none; color:var(--accent); padding:8px 10px 8px 0; font-size:.82rem; }
html:root .mini-album button.image-thumbnail { width:48px; height:48px; border-radius:10px; }
html:root .mini-album .image-thumbnail img { width:48px; height:48px; object-fit:cover; }

/* Formatting is revealed in place; toggling tools never discards the draft. */
html:root .news-rich-editor { position:relative; min-width:0; width:100%; }
html:root .rich-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:3px; padding:8px 12px; border-bottom:1px solid var(--border); background:var(--surface); color:var(--text-secondary); animation:crm-page-in 180ms var(--motion-ease); }
html:root button.rich-tool { display:grid; place-items:center; width:34px; height:36px; padding:0; border:0; border-radius:7px; color:var(--text-secondary); background:transparent; box-shadow:none; font-size:1rem; }
html:root .rich-tool:is(:hover,[aria-pressed="true"]) { color:var(--accent); background:var(--accent-soft); }
html:root button.rich-tool[aria-label="Жирный"] { font-weight:800; }
html:root button.rich-tool[aria-label="Курсив"] { font-style:italic; }
html:root button.rich-tool[aria-label="Подчёркнутый"] { text-decoration:underline; }
html:root button.rich-tool[aria-label="Зачёркнутый"] { text-decoration:line-through; }
html:root .rich-toolbar select { width:auto; max-width:122px; min-height:36px; padding:5px 26px 5px 8px; font-size:.76rem; border-radius:6px; margin:0 6px; }
html:root .rich-color { width:30px; height:34px; min-height:0; padding:3px; margin:0 5px 0 0; border:0; background:transparent; cursor:pointer; }
html:root .rich-color-tool { display:grid; place-items:center; position:relative; width:30px; height:32px; margin:0 5px; border-bottom:3px solid var(--rich-color,var(--text-secondary)); font-size:1rem; font-weight:600; cursor:pointer; }
html:root .rich-color-tool input { position:absolute; inset:0; opacity:0; width:100%; height:100%; padding:0; margin:0; cursor:pointer; }
html:root .rich-editable { min-height:180px; max-height:440px; overflow-y:auto; width:100%; padding:22px 25px; outline:0; border:0; color:var(--text-primary); background:var(--surface); font-size:1rem; line-height:1.6; overflow-wrap:anywhere; font-weight:400; }
html:root .rich-editable:focus { background:var(--surface-active); }
html:root .rich-editable:empty::before { content:attr(data-placeholder); color:var(--text-secondary); pointer-events:none; }
html:root :is(.rich-editable,.rich-rendered) :is(p,div) { margin:0 0 .7em; }
html:root :is(.rich-editable,.rich-rendered) :is(ul,ol) { padding-left:1.6em; margin:.6em 0; }
html:root :is(.rich-editable,.rich-rendered) blockquote { margin:12px 0; padding:12px 18px; border-left:3px solid var(--accent); background:var(--surface-active); }
html:root :is(.rich-editable,.rich-rendered) pre { white-space:pre-wrap; }
html:root .news-body.rich-rendered { white-space:normal; }
html:root .rich-inline-image { display:block; max-width:100%; width:auto; height:auto; max-height:280px; object-fit:contain; border-radius:12px; margin:10px 0; }
html:root button.rich-image-link { display:block; width:fit-content; max-width:100%; border:0; padding:0; background:transparent; box-shadow:none; cursor:zoom-in; }
html:root .rich-toggle { margin-left:auto; min-width:36px; font-weight:700; }
html:root .news-inline-editor .news-rich-editor { margin:8px 0; }
html:root .news-inline-editor .rich-editable { padding:12px; min-height:110px; font-size:1rem; }
html:root .rich-link-menu,html:root .rich-mentions { position:absolute; right:12px; top:52px; z-index:30; padding:16px; background:var(--surface); color:var(--text-primary); box-shadow:0 12px 35px #00000025; border:1px solid var(--border); border-radius:14px; width:min(360px,calc(100% - 24px)); }
html:root .rich-link-menu label { display:block; font-size:.8rem; margin-bottom:12px; }
html:root .rich-link-menu button { margin:12px 8px 0 0; }
html:root .rich-mention-list { max-height:240px; overflow-y:auto; padding-top:8px; }
html:root .rich-mentions .mention-option { display:block; width:100%; text-align:left; }
html:root .rich-editor-expanded { position:fixed; inset:16px; margin:0; padding:0; z-index:240; width:auto; height:auto; max-width:none; max-height:none; min-height:0; display:flex; flex-direction:column; border:1px solid var(--border); border-radius:20px; overflow:hidden; background:var(--surface); box-shadow:0 20px 70px #00000040; }
html:root .rich-editor-expanded::backdrop { background:#11182766; }
html:root .news-image-picker[popover] { inset:auto; margin:0; }
html:root .rich-editor-expanded .rich-toolbar { flex:0 0 auto; animation:none; }
html:root .rich-editor-expanded .rich-editable { flex:1 1 0; min-height:0; max-height:none; overscroll-behavior:contain; }
html:root .rich-editor-expanded .rich-fullscreen { margin-left:auto; }
html:root body:has(.rich-editor-expanded:popover-open) { overflow:hidden; }
@media(max-width:600px) {
  html:root .file-upload-panel { padding:12px; }
  html:root .attachment-cards { gap:10px; }
  html:root .pending-image.attachment-card { width:calc(50% - 5px); max-width:148px; height:120px; }
  html:root .attachment-remove { opacity:.95; }
  html:root button.attachment-upload-tile { width:112px; height:106px; flex-shrink:0; gap:10px; }
  html:root .attachment-upload-actions { grid-template-columns:112px minmax(0,1fr); gap:12px; }
  html:root .attachment-drop-zone { padding:12px 6px; font-size:.72rem; }
  html:root .rich-toolbar { padding:6px; gap:2px; }
  html:root .rich-tool { min-width:34px; }
  html:root .rich-editable { padding:18px; min-height:150px; }
  html:root .rich-editor-expanded { inset:6px; }
}

/* Editor quick actions share one baseline, size and focus treatment. */
html:root :is(.composer-tools,.message-toolbar) { align-items:center; gap:8px 18px; }
html:root .composer-tools { padding:8px 20px; }
html:root #news-form .composer-tools > button.composer-tool-button { display:inline-flex; align-items:center; min-height:36px; padding:0; line-height:1.25; font-weight:500; margin:0; }
html:root .editor-quick-tools { display:flex; align-items:center; gap:6px; margin:6px 0; }
html:root .composer-icon-tools { margin:0 0 0 auto; }
html:root :is(#news-form,.news-inline-editor) .editor-quick-tools button.editor-icon-button { display:grid; place-items:center; width:36px; height:36px; min-height:36px; min-width:36px; margin:0; padding:0; border:0; border-radius:8px; background:transparent; color:var(--text-secondary); box-shadow:none; text-decoration:none; font-size:20px; line-height:1; }
html:root :is(#news-form,.news-inline-editor) .editor-quick-tools button.rich-toggle { font-size:16px; font-weight:650; }
html:root :is(#news-form,.news-inline-editor) .editor-quick-tools button:is(:hover,[aria-expanded="true"]) { background:var(--surface-hover); color:var(--accent); }

/* The same employee picker lives in the top layer in every writing surface. */
html:root .mention-picker { display:flex; flex-direction:column; position:fixed; inset:auto; z-index:490; margin:0; padding:4px; width:min(480px,calc(100vw - 20px)); min-width:0; overflow:hidden; border-radius:12px; background:var(--surface); color:var(--text-primary); border:1px solid var(--border); box-shadow:var(--shadow-dropdown); }
html:root .mention-picker-list { flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:0; }
html:root .mention-picker button.mention-picker-option { display:grid; grid-template-columns:40px minmax(0,1fr) auto; align-items:center; gap:12px; width:100%; min-height:60px; margin:0; padding:8px 10px; border:0; border-radius:7px; background:transparent; color:var(--text-primary); box-shadow:none; text-align:left; font-size:.92rem; font-weight:400; }
html:root .mention-picker button.mention-picker-option:is(:hover,[aria-selected="true"]) { background:var(--surface-hover); }
html:root .mention-choice-avatar { width:40px; height:40px; flex-shrink:0; border-radius:50%; font-size:1.1rem; background:var(--accent-soft); color:var(--accent); overflow:hidden; }
html:root .mention-choice-avatar img { width:100%; height:100%; object-fit:cover; }
html:root .mention-choice-info { display:flex; flex-direction:column; min-width:0; gap:3px; }
html:root .mention-choice-info strong { font-size:.92rem; font-weight:600; line-height:1.3; }
html:root .mention-choice-info :is(strong,.mention-choice-detail) { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
html:root .mention-choice-detail { font-size:.8rem; color:var(--text-secondary); line-height:1.3; }
html:root .mention-choice-context { border-left:1px solid var(--border); padding-left:10px; color:var(--text-secondary); font-size:.73rem; white-space:nowrap; }
html:root .mention-picker-help { display:flex; flex-wrap:wrap; gap:4px 12px; flex:0 0 auto; padding:8px 10px 6px; margin-top:3px; border-top:1px solid var(--border); color:var(--text-secondary); font-size:.67rem; line-height:1.4; }
html:root .mention-picker-help b { font-weight:500; color:var(--accent); }
html:root :is(.mention-picker-list[role="status"],.mention-picker-status) { padding:14px 12px; margin:0; color:var(--text-secondary); font-size:.85rem; }
@media(max-width:400px) {
  html:root .composer-tools { padding-inline:12px; gap:6px 12px; }
  html:root .mention-picker button.mention-picker-option { gap:9px; padding-inline:8px; }
  html:root .mention-choice-context { font-size:.65rem; padding-left:6px; }
}
@media(prefers-reduced-motion:reduce) {
  html:root :is(.attachment-remove,.attachment-more,.attachment-upload-tile,.attachment-drop-zone) { transition:none; }
  html:root .rich-toolbar,html:root .attachment-card { animation:none; }
  html:root :is(.rich-editor-expanded,.mention-picker) { transition:none; }
}

