:root { color-scheme: light; --ink:#17334b; --muted:#667888; --line:#dce5eb; --blue:#275e8e; --paper:#fff; --canvas:#edf3f7; --max:#76609e; --soft:#f7fafc; font-family:"Avenir Next","Segoe UI",sans-serif; }
* { box-sizing:border-box }
body { margin:0; color:var(--ink); background:var(--canvas); height:100dvh; display:flex; flex-direction:column }
button,textarea,input,select { font:inherit }
button { cursor:pointer } button:disabled { cursor:default; opacity:.5 }
[hidden] { display:none!important }
:focus-visible { outline:3px solid #e7a640; outline-offset:2px }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap }
input,select,textarea { min-width:0; max-width:100%; border:1px solid #bccdd9; border-radius:7px; padding:8px 10px; background:white; color:var(--ink) }
label { font-size:12px; font-weight:600; display:block; margin-bottom:6px; color:var(--muted) }

/* Header: slim, with history search */
.brand { height:56px; padding:0 20px; display:flex; align-items:center; gap:12px; background:var(--ink); color:white }
.mark { width:32px; height:32px; display:grid; place-items:center; background:#fff; color:var(--blue); border-radius:9px 9px 3px 9px; font-size:22px; font-weight:600; flex-shrink:0 }
.brand strong { font-size:17px; white-space:nowrap }
/* The browser's own clear mark is dark grey on dark blue: our own, light one instead. */
.search-clear { position:absolute; right:8px; top:50%; transform:translateY(-50%); width:24px; height:24px; display:grid; place-items:center; padding:0; border:0; border-radius:50%; background:#e7eef4; color:var(--ink); font-size:12px; font-weight:700; line-height:1; cursor:pointer }
.search-clear:hover,.search-clear:focus-visible { background:white }
.ghost { border:1px solid var(--line); background:white; color:var(--blue); padding:8px 12px; border-radius:7px; white-space:nowrap }
.brand-actions { margin-left:auto; display:flex; gap:8px }
.brand .ghost { background:transparent; color:white; border-color:#5d7a92 }
.brand { flex-shrink:0 }

/* Layout: queue rail, list, conversation — left to right, as the eye reads the work */
main { display:grid; grid-template-columns:136px 360px minmax(0,1fr); flex:1; min-height:0; background:var(--paper) }
.thread { display:flex; flex-direction:column; min-height:0 }
.thread-heading { position:relative; padding:14px 24px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; gap:16px }

/* Queue rail: continues the dark header, so the frame of the work reads as one piece */
.rail { background:var(--ink); padding:10px 8px; overflow:auto }
.rail-tabs { display:flex; flex-direction:column; gap:2px }
.rail [role=tab] { display:flex; flex-direction:column; align-items:flex-start; gap:3px; width:100%; border:0; background:transparent; color:#b9cad8; text-align:left; padding:8px 8px 8px 10px; border-radius:8px; font-size:13px; line-height:1.25; overflow-wrap:break-word; position:relative }
.rail [role=tab]:hover { background:#21405a; color:white }
.rail [role=tab][aria-selected="true"] { background:#2b4a63; color:white; font-weight:600 }
.rail [role=tab][aria-selected="true"]::before { content:""; position:absolute; left:0; top:8px; bottom:8px; width:3px; border-radius:2px; background:#e7a640 }
.rail .rail-tasks { margin-top:10px; border-top:1px solid #2b4a63; border-radius:0 0 8px 8px }
.rail-count { min-width:22px; padding:1px 7px; border-radius:10px; background:#3b5a73; color:white; font-size:12px; font-weight:600; text-align:center }
.rail-count.urgent { background:#c8412b }
.rail .tab-count { background:#3b5a73; color:white; font-size:12px }
.rail .tab-count.overdue { background:#c8412b }
/* The name is never squeezed by the buttons: with little room they wrap under it. */
.thread-heading { flex-wrap:wrap }
.who { min-width:0; flex:1 1 240px }
.thread-heading h2 { margin:0; font-size:19px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.thread-heading p { font-size:12px; margin:4px 0 0; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.thread-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:2px 4px; align-items:center; min-width:0 }
.thread-actions button { border:1px solid transparent; background:transparent; color:var(--blue); padding:7px 8px; border-radius:7px; white-space:nowrap }
.thread-actions button:hover:not(:disabled) { background:#eef4f9 }
/* One main action per chat: the filled button; the rest stay quiet. */
.thread-actions button.primary { background:var(--blue); color:white; font-weight:600; padding:7px 14px }
.thread-actions button.primary:hover { background:#1f4c74 }
#more-toggle { border-color:var(--line) }
#more-toggle .caret { font-size:11px }
.more-menu { position:absolute; right:24px; top:calc(100% - 6px); z-index:6; display:flex; flex-direction:column; gap:6px; min-width:220px; padding:12px; background:white; border:1px solid var(--line); border-radius:10px; box-shadow:0 8px 28px #0002 }
.more-menu label { margin:0 }
.more-menu select { width:100%; margin-bottom:4px }
.more-menu button { border:1px solid var(--line); background:white; color:var(--blue); padding:8px 12px; border-radius:7px; text-align:left }
.more-menu button:hover { background:#eef4f9 }
.back { display:none; border:0; background:none; color:var(--blue); font-weight:600; padding:6px 4px; flex-shrink:0 }
/* Contact panel (ADR-012): beside the conversation on wide screens, over it on narrower ones. */
main { position:relative }
main.with-panel { grid-template-columns:136px 360px minmax(0,1fr) 320px }
.context-panel { display:flex; flex-direction:column; gap:18px; min-height:0; overflow:auto; padding:16px 18px 20px; background:var(--soft); border-left:1px solid var(--line) }
.panel-head { display:flex; align-items:center; justify-content:space-between; gap:8px }
.panel-head h3 { margin:0; font-size:16px }
.panel-head .ghost { padding:5px 10px; font-size:13px }
.panel-section { display:flex; flex-direction:column; gap:4px }
.panel-section h4 { margin:0 0 6px; font-size:12px; font-weight:700; letter-spacing:.02em; color:var(--muted) }
.panel-section label { margin:6px 0 2px }
.panel-section input,.panel-section select,.panel-section textarea { width:100% }
.panel-section textarea { resize:vertical }
.panel-facts { display:grid; grid-template-columns:auto minmax(0,1fr); gap:6px 12px; margin:10px 0 0; font-size:13px }
.panel-facts dt { color:var(--muted) }
.panel-facts dd { margin:0; overflow-wrap:anywhere }
.panel-tasks { display:flex; flex-direction:column; gap:6px }
.panel-task { display:flex; align-items:flex-start; gap:8px; padding:8px; background:white; border:1px solid var(--line); border-radius:8px }
.panel-task-text { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px }
.panel-task-text strong { font-size:13px; overflow-wrap:anywhere }
.panel-task-text .sub { display:block; margin:0; font-size:12px }
#panel-task-add { align-self:flex-start; margin-top:6px }
@media(max-width:1359px) {
  .context-panel { position:absolute; top:0; right:0; bottom:0; z-index:7; width:min(360px,100%); box-shadow:-8px 0 28px #0002 }
}
.card-bar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:10px }
.card-bar button:not(.ghost) { background:var(--blue); color:white; border:0; padding:9px 18px; border-radius:7px }
#card-status { font-size:12px; color:var(--muted) }
.history { flex:1; overflow:auto; overflow-anchor:none; padding:20px 24px; background:var(--soft) }  /* the hub keeps the reader's place itself (app.js keepPlace) */
#messages { display:flex; flex-direction:column; gap:12px; max-width:980px; margin:0 auto }
.message { align-self:flex-start; max-width:min(78%,720px); background:white; border:1px solid var(--line); border-radius:14px 14px 14px 3px; padding:10px 14px }
.message.outgoing { align-self:flex-end; background:#e4eff8; border-color:#d2e4f2; border-radius:14px 14px 3px 14px }
.message.found { box-shadow:0 0 0 3px #e7a640 }
.message.room-copy { background:#f4f6f8; border-style:dashed }
.copy-actions { display:flex; gap:12px }
.sender { display:block; font-size:12px; font-weight:600; color:var(--blue); margin-bottom:4px }
.message p { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.55; font-size:15px }
.meta { display:block; margin-top:6px; color:var(--muted); font-size:11px }
.message-foot { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:6px }
.message-foot .meta { margin:0 }
.msg-delete { border:0; background:none; color:var(--muted); font-size:11px; padding:2px 0; opacity:.7 }
.msg-more { display:none; border:0; background:none; color:var(--muted); font-size:16px; line-height:1; padding:2px 8px }
.msg-delete:hover,.msg-delete:focus-visible { color:#9b2c2c; opacity:1 }
.message p.deleted { color:var(--muted); font-style:italic }
.quote { display:block; width:100%; text-align:left; border:0; border-left:3px solid var(--blue); background:#eef4f9; padding:5px 9px; margin:0 0 6px; border-radius:4px; color:var(--ink); font-size:13px }
.message.outgoing .quote { background:#d7e7f4 }
.quote b { display:block; font-size:12px; color:var(--blue) }
.quote span { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted) }
.message.flash { box-shadow:0 0 0 3px #e7a640; transition:box-shadow .3s }
.msg-actions { display:flex; gap:12px }
.msg-action { border:0; background:none; color:var(--muted); font-size:11px; padding:2px 0; opacity:.8 }
.msg-action:hover,.msg-action:focus-visible { color:var(--blue); opacity:1 }
.marks { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px }
.msg-mark { font-size:11px; padding:2px 8px; white-space:nowrap; border-radius:10px; background:#e3f3e6; color:#1f5f2c; border:1px solid #bfe0c6 }
.mark-picker { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px }
.mark-picker button { font-size:12px; padding:4px 10px; border-radius:14px; border:1px solid var(--line); background:white; color:var(--ink) }
.mark-picker button[aria-pressed="true"] { background:#1f5f2c; border-color:#1f5f2c; color:white }
.react-picker button { font-size:18px; padding:2px 8px; line-height:1.3 }
.react-picker button[aria-pressed="true"] { background:#e4eff8; border-color:var(--blue); color:inherit }
.msg-mark.reaction { background:#eef4f9; color:var(--ink); border-color:var(--line) }
.reply-bar { display:flex; align-items:center; justify-content:space-between; gap:10px; border-left:3px solid var(--blue); background:#eef4f9; padding:6px 10px; margin-bottom:8px; border-radius:4px; font-size:13px }
.reply-bar span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.reply-bar button { border:0; background:none; font-size:18px; line-height:1; color:var(--muted); padding:0 4px }
.removed-note { display:block; margin-top:6px; font-size:11px; color:#935221 }
.message[data-status="uncertain"],.message[data-status="failed"] { border-color:#bc8059 }
.message[data-status="uncertain"] .meta,.message[data-status="failed"] .meta { color:#935221 }
.attachment { display:block; margin-top:8px; color:var(--blue); overflow-wrap:anywhere; font-size:14px }
.message img { display:block; max-width:100%; max-height:260px; margin-top:10px; object-fit:contain; border-radius:6px }
#empty-thread { text-align:center; color:var(--muted); margin-top:18vh }
.quiet { display:block; margin:0 auto 16px; border:1px solid var(--line); background:white; color:var(--blue); padding:7px 14px; border-radius:6px }
#composer { padding:12px 24px 16px; border-top:1px solid var(--line) }
#composer > label { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0) }
#reply { width:100%; resize:vertical; min-height:64px; max-height:200px; padding:11px }
/* «Отправить» stands right of the field and is as tall as it: the pointer is already there after typing,
   and a button flush with the field's edges reads as one control (owner, 25.11.2026). */
.reply-row { display:flex; align-items:stretch; gap:10px }
.reply-row #reply { flex:1; min-width:0; width:auto }
.reply-row #send { flex-shrink:0 }
.composer-tools { display:flex; align-items:center; gap:10px; margin-top:8px; flex-wrap:wrap }
.composer-tools label { margin:0 }
/* The native file input is replaced by a clear button; the label opens the picker itself. */
.file-input { position:absolute; width:1px; height:1px; opacity:0; overflow:hidden }
.attach { display:inline-flex; align-items:center; gap:4px; border:1px solid var(--line); border-radius:7px; padding:6px 12px; background:white; color:var(--blue); font-size:13px; font-weight:600; cursor:pointer }
.file-input:focus-visible + .attach, .attach:focus-within { outline:3px solid #e7a640 }
.file-input:disabled ~ .attach { opacity:.5; cursor:default }
.file-clear { border:0; background:none; font-size:18px; line-height:1; color:var(--muted); padding:4px 8px; margin-left:-6px; min-width:32px; min-height:32px }
.composer-tools { position:relative }
.emoji-panel { position:absolute; bottom:calc(100% + 6px); left:0; z-index:5; display:grid; grid-template-columns:repeat(8, 36px); gap:2px; padding:8px; background:white; border:1px solid var(--line); border-radius:10px; box-shadow:0 6px 24px #0002 }
.emoji-panel button { border:0; background:none; font-size:20px; padding:4px; border-radius:6px; cursor:pointer }
.emoji-panel button:hover,.emoji-panel button:focus-visible { background:#eef4f9 }
.composer-tools .meta { margin:0 }
.send-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:8px }
#send-status { font-size:12px; color:var(--muted); line-height:1.4 }
#send { background:var(--blue); color:white; border:0; padding:10px 22px; border-radius:7px }
#next-message { background:white; color:var(--blue); border:1px solid var(--line); padding:8px; border-radius:6px; font-size:12px }

/* Chat list, left of the conversation */
aside { padding:14px 14px 10px; display:flex; flex-direction:column; min-height:0; background:var(--paper); border-right:1px solid var(--line) }
.tabs { display:flex; gap:4px; background:var(--canvas); padding:3px; border-radius:9px; margin-bottom:8px }
.tabs button { flex:1; border:0; background:transparent; padding:6px; border-radius:7px; color:var(--muted); font-weight:600 }
.tabs button[aria-selected="true"] { background:white; color:var(--ink); box-shadow:0 1px 2px #0001 }
.folders { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:8px }
.folders button { border:1px solid var(--line); background:white; color:var(--ink); padding:3px 9px; border-radius:20px; font-size:12px }
.folders button[aria-pressed="true"] { background:var(--blue); border-color:var(--blue); color:white }
.folders .add { color:var(--blue); border-style:dashed }
.chip-count { display:inline-block; margin-left:6px; min-width:18px; padding:0 5px; border-radius:9px; background:var(--blue); color:white; font-size:11px; text-align:center }
.folders button[aria-pressed="true"] .chip-count { background:white; color:var(--blue) }
.new-flag { font-size:11px; font-weight:600; color:#1f5f2c; margin-right:auto }
.message.unseen { border-color:#9fcfaa }
.message.system { align-self:center; background:none; border:0; padding:2px 8px; max-width:90% }
.message.system p { font-size:12px; color:var(--muted); text-align:center }
.deliveries { display:flex; flex-wrap:wrap; gap:4px 8px; margin-top:4px; font-size:11px; color:var(--muted) }
.deliveries .bad { color:#9b2c2c }
.deliveries button { border:0; background:none; color:var(--blue); font-size:11px; padding:0 }
#room-create { background:var(--blue); color:white; border:0; padding:9px 18px; border-radius:7px }
.folder-actions { display:flex; gap:8px; margin:-4px 0 10px }
.folder-actions button { border:0; background:none; color:var(--blue); font-size:12px; padding:2px 0 }
#folder-delete { color:#935221 }
#newer { margin:16px auto 0 }
#search { width:100%; margin-bottom:8px }
.filters { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px }
.filter { display:flex; align-items:center; gap:6px; margin:0; font-weight:400; color:var(--ink); font-size:13px }
#status-filter { padding:5px 8px; font-size:13px }
.presets { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px }
.presets button { border:1px solid var(--line); background:white; color:var(--blue); padding:6px 10px; border-radius:14px; font-size:12px }
#remind-save { background:var(--blue); color:white; border:0; padding:9px 18px; border-radius:7px }
#list-error,.list-action { color:#935221; font-size:12px; margin:0 0 6px }
.list-action:empty { display:none }
#conversations,#search-results { display:flex; flex-direction:column; gap:2px; overflow:auto; flex:1; min-height:0 }
.dialog,.hit { border:0; background:transparent; text-align:left; padding:10px; width:100%; border-radius:8px; color:var(--ink) }
.dialog { padding:6px 10px; display:flex; flex-direction:column; gap:2px }
.dialog-line { display:flex; align-items:center; gap:6px; min-width:0; font-size:13px; color:var(--muted) }
/* The label beside the name takes what is left and is cut with «…» (only a block gets it). */
.dialog .dialog-head .sub { flex:1 1 0; display:block; margin:0; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; color:var(--muted) }
.dialog .time { margin-left:auto; flex-shrink:0; font-size:11px; color:var(--muted) }
.dialog .preview,.dialog .description { flex:1; min-width:0; margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; -webkit-line-clamp:unset }
.dialog:hover,.hit:hover { background:#f1f6f9 }
.dialog.selected { background:#e7f0f7; box-shadow:inset 3px 0 var(--blue) }
/* Waiting bar (ADR-011): nobody waits unnoticed. A drawn strip, no text: the row's own words say it. */
.dialog { position:relative }
.dialog[data-wait]::before { content:""; position:absolute; left:0; top:4px; bottom:4px; width:4px; border-radius:0 3px 3px 0; background:var(--wait) }
.dialog.selected[data-wait]::before { left:3px }  /* the open chat keeps its blue edge */
.dialog[data-wait="fresh"] { --wait:#f3d35c } .dialog[data-wait="warm"] { --wait:#ee8a2a } .dialog[data-wait="late"] { --wait:#d8392f }
/* Phone swipes (ADR-013): the row's content follows the finger, the action shows beneath. */
.dialog[data-swipe] > span { transform:translateX(var(--swipe, 0px)) }
.dialog[data-swipe="done"] { background:#e3f3e6 } .dialog[data-swipe="remind"] { background:#e5ecfb }
.dialog[data-swipe]::after { position:absolute; top:50%; transform:translateY(-50%); font-size:12px; font-weight:600; opacity:.55 }
.dialog[data-swipe="done"]::after { content:"Ответ не нужен"; left:12px; color:#1f5f2c }
.dialog[data-swipe="remind"]::after { content:"Напомнить"; right:12px; color:#23407a }
.dialog.swipe-ready::after { opacity:1 }
.dialog .time.wait { font-weight:600; color:var(--ink) }
.dialog[data-wait="warm"] .time.wait { color:#8f4700 } .dialog[data-wait="late"] .time.wait { color:#a3241c }
.dialog-head { display:flex; align-items:center; gap:8px }
.dialog strong,.hit strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:14px; flex:1; min-width:0 }
/* The name comes first: it keeps its own width — a long «в общем чате «…»» beside it must
   never squeeze it to nothing; with a label it gives up at most 35 % of the row. */
.dialog .dialog-head strong { flex:0 1 auto }
.dialog .dialog-head strong:has(+ .sub) { max-width:65% }
.badge { font-size:11px; color:var(--blue); flex-shrink:0 } .badge.max { color:var(--max) }
.unread-count { background:var(--blue); color:white; min-width:20px; padding:1px 6px; border-radius:12px; font-size:11px; text-align:center; flex-shrink:0 }
.sub { display:flex; gap:6px; align-items:center; margin-top:4px; font-size:12px; color:var(--muted); min-width:0 }
.sub span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.pill { flex-shrink:0; font-size:11px; padding:1px 7px; border-radius:10px; background:#eef3f7; color:var(--ink) }
.pill.reply { background:#fde2e1; color:#8a1f1a }
.dialog { cursor:pointer }
.dialog[aria-disabled="true"] { cursor:default; opacity:.6 }
.pill.with-off { display:inline-flex; align-items:center; gap:5px; padding-right:3px }
/* The ✕ is a clear round button of its own, not a faint letter (owner 09.10); only it
   takes the badge off. */
button.reply-off { display:inline-grid; place-items:center; width:15px; height:15px; padding:0; border:0; border-radius:50%; background:#8a1f1a; cursor:pointer }
button.reply-off::after { content:"✕"; color:white; font-size:9px; font-weight:700; line-height:1 }
button.reply-off:hover,button.reply-off:focus-visible { background:#5e120e }
.pill.remind { background:#e5ecfb; color:#23407a }
.pill.waiting { background:#fdf0dc; color:#7a4b0d } .pill.paused { background:#eceaf3; color:#4d4370 } .pill.archived { background:#eee; color:#666 }
.preview { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:4px; color:var(--muted); font-size:13px }
.description { display:block; margin-top:4px; color:var(--muted); font-size:12px; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical }
.hit mark { background:#fbe3a6; color:inherit; padding:0 1px; border-radius:2px }
.results-head { display:flex; justify-content:space-between; align-items:center; font-size:13px; color:var(--muted); padding:4px 4px 8px }
.results-head button { border:0; background:none; color:var(--blue); padding:2px 4px }
#empty-list { font-size:13px; line-height:1.6; margin:12px 4px; color:var(--muted) }
.list-pages { display:flex; align-items:center; justify-content:space-between; gap:8px; padding-top:8px; font-size:12px; border-top:1px solid var(--line) }
.list-pages button { border:1px solid var(--line); background:white; color:var(--blue); padding:6px 10px; border-radius:6px }

/* Tasks */
.tab-count { display:inline-block; min-width:18px; padding:0 5px; border-radius:9px; background:#dbe6ee; color:var(--ink); font-size:11px; font-weight:600 }
.tab-count.overdue { background:#9b2c2c; color:white }
aside.tasks-mode #folders,aside.tasks-mode #search,aside.tasks-mode #conversations,aside.tasks-mode #pb-pin,
aside.tasks-mode #search-results,aside.tasks-mode #empty-list,aside.tasks-mode #list-pages { display:none!important }
.task-pane { display:flex; flex-direction:column; flex:1; min-height:0 }
.task-pane .filters select { flex:1; padding:5px 8px; font-size:13px }
.task-list { display:flex; flex-direction:column; gap:4px; overflow:auto; flex:1; min-height:0 }
.task-row { display:flex; align-items:flex-start; gap:8px; padding:6px 8px; border-radius:8px }
.task-row:hover { background:#f1f6f9 }
.task-check { flex-shrink:0; width:26px; height:26px; margin-top:2px; border:1px solid #9fb6c6; border-radius:50%; background:white; color:transparent; font-weight:700 }
.task-check:hover,.task-check:focus-visible { color:#1f5f2c; border-color:#1f5f2c }
.task-row.closed .task-check { width:auto; height:auto; border-radius:6px; color:var(--blue); font-size:12px; padding:3px 8px; font-weight:400 }
.task-main { flex:1; min-width:0; border:0; background:none; text-align:left; padding:0; color:var(--ink) }
.task-main strong { display:block; font-size:14px; overflow-wrap:anywhere }
.task-row.closed .task-main strong { text-decoration:line-through; color:var(--muted) }
.task-main .sub { display:block; margin-top:2px; white-space:normal }
.task-main .source { display:block; font-size:12px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin-top:2px }
.task-edit { flex-shrink:0; border:0; background:none; color:var(--blue); font-size:12px; padding:4px 0 }
.overdue-text { color:#9b2c2c; font-weight:600 }
.task-undo { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12px; background:#e3f3e6; color:#1f5f2c; padding:6px 8px; border-radius:6px; margin:0 0 6px }
.task-undo button { border:0; background:none; color:var(--blue); font-weight:600; font-size:12px; padding:2px 4px }
.task-empty { font-size:13px; line-height:1.6; margin:12px 4px; color:var(--muted) }
.pill.task { background:#fff3d6; color:#6b4a00 }
.msg-tasks { display:flex; flex-direction:column; gap:4px; margin-top:6px }
.msg-task { display:flex; flex-wrap:wrap; align-items:center; gap:6px; font-size:12px; padding:4px 8px; border-radius:8px; background:#fff3d6; border:1px solid #f0dca6; color:#5a3e00 }
.msg-task.closed { background:#eef3f7; border-color:var(--line); color:var(--muted) }
.msg-task.closed span { text-decoration:line-through }
.msg-task button { border:0; background:none; color:var(--blue); font-size:12px; padding:0 2px }
#task-save,#task-done-ok { background:var(--blue); color:white; border:0; padding:9px 18px; border-radius:7px }
.task-drop-bar { margin-top:14px }
/* A removing action never looks like the working ones: red outline, apart from «Сохранить». */
.card-bar button.danger-quiet { background:white; color:#9b2c2c; border:1px solid #d7b3b3; padding:8px 14px; border-radius:7px }
#task-note { width:100%; margin-bottom:10px; resize:vertical }
.task-add { align-self:flex-start; border:1px solid var(--blue); background:white; color:var(--blue); padding:6px 12px; border-radius:7px; font-size:13px; font-weight:600; margin-bottom:8px }
.task-main .note,.msg-task .note { display:block; font-size:12px; color:var(--ink); white-space:pre-wrap; overflow-wrap:anywhere; margin-top:2px }
.task-main .note { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden }
.msg-task .note { flex-basis:100%; text-decoration:none }
#task-done-dialog .filter { font-size:14px; margin:4px 0 8px }
#task-done-dialog .filter input { width:auto; margin:0 }
#task-dialog .presets button[aria-pressed="true"] { background:var(--blue); border-color:var(--blue); color:white }

/* Mail */
.badge.email { color:#2f6b3b } .badge.pricebridge { color:#7a3fb0 }
.message .subject { display:block; font-size:13px; margin-bottom:4px; color:var(--ink) }
.letter-toggle { display:block; margin-top:4px }
.mail-senders { display:flex; flex-direction:column; gap:4px }
.mail-sender { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12px }
.mail-sender .danger-quiet { font-size:11px; padding:2px 8px; border-radius:6px }
#mail-sender { font-size:12px; padding:4px 6px; flex:1 }
.mail-subject { display:flex; align-items:center; gap:8px; margin-bottom:6px }
.mail-subject label { margin:0; white-space:nowrap }
.mail-subject input { flex:1 }
#mail-new-dialog .filter input { width:auto; margin:0 }
#mail-new-open-chat { background:var(--blue); color:white; border:0; padding:9px 18px; border-radius:7px }

/* Login page */
.login-page { align-items:center; justify-content:center; padding:16px }
.login-box { width:min(380px,100%); background:var(--paper); border-radius:12px; padding:24px; box-shadow:0 4px 24px #0001; display:block }
.login-brand { display:flex; align-items:center; gap:10px; margin-bottom:12px; color:var(--ink) }
.login-box h1 { font-size:20px; margin:0 0 12px }
.login-box input { width:100%; margin-bottom:12px }
#login-submit { width:100%; background:var(--blue); color:white; border:0; padding:11px; border-radius:7px; font-weight:600 }
/* Account, users */
.account { display:flex; flex-wrap:wrap; align-items:center; gap:4px 10px; margin-bottom:4px }
.account button { border:0; background:none; color:var(--blue); font-size:12px; padding:2px 0 }
.users-list { display:flex; flex-direction:column; gap:6px; max-height:260px; overflow:auto; margin:8px 0 }
.user-row { display:flex; flex-wrap:wrap; align-items:center; gap:8px; border:1px solid var(--line); border-radius:7px; padding:8px 10px; font-size:13px }
.user-row strong { flex:1; min-width:120px }
.user-row.off { opacity:.55 }
.user-row button,.user-row select { font-size:12px; padding:4px 8px; border:1px solid var(--line); border-radius:6px; background:white; color:var(--blue) }
.user-new input,.user-new select { width:100%; margin-bottom:8px }
#password-save,#user-create { background:var(--blue); color:white; border:0; padding:9px 18px; border-radius:7px }
.author { color:var(--blue) }

/* Settings: a window of their own, opened from the header */
#settings-dialog { width:min(560px,94vw) }
.settings-body { display:flex; flex-direction:column; gap:10px }
.settings-body .filter { font-size:13px }
.settings-body .filter input[type=checkbox] { width:auto; margin:0 }
.settings-body .filter select { flex:1; width:auto; margin:0 }
.settings-body .account { font-size:13px }
.prefs { display:flex; flex-direction:column; gap:8px }
.brand .settings-open { border-color:#8fa7ba }
.alerts { display:flex; flex-direction:column; gap:4px; padding:6px 0; border-top:1px dashed var(--line); border-bottom:1px dashed var(--line) }
.alerts strong { font-size:12px }
.alerts-actions { display:flex; flex-wrap:wrap; gap:6px; align-items:center }
.alerts button { border:1px solid var(--line); background:white; color:var(--blue); font-size:12px; padding:4px 8px; border-radius:6px }
.share-setup { display:flex; flex-direction:column; gap:6px; font-size:13px }
.share-steps { margin:0; padding-left:20px; display:flex; flex-direction:column; gap:6px }
.share-steps .link-row { margin-top:4px }
#share-key { font-family:ui-monospace, Menlo, monospace; font-size:12px; min-width:0; flex:1 }
#alerts-mode { font-size:12px; padding:3px 6px }
#alerts-links { display:flex; flex-direction:column; gap:6px }
.folder-admin { display:flex; flex-wrap:wrap; align-items:center; gap:4px 10px; font-size:12px; color:var(--muted) }
.folder-admin button { border:0; background:none; color:var(--blue); font-size:12px; padding:2px 0 }
#folder-delete { color:#935221 }
#notify-enable { border:1px solid var(--blue); background:white; color:var(--blue); padding:6px 10px; border-radius:6px; font-size:12px; text-align:left; margin-top:6px }

/* Delete / group / members dialogs */
.delete-actions { display:flex; flex-direction:column; gap:8px; margin-top:8px }
.delete-actions button { padding:10px 14px; border-radius:7px; font-weight:600 }
.danger { background:#9b2c2c; color:white; border:0 }
.danger-quiet { background:white; color:#9b2c2c; border:1px solid #d7b3b3 }
.steps { font-size:13px; line-height:1.55; color:var(--ink); padding-left:20px; margin:10px 0 }
#group-links,#members-link-row { display:flex; flex-direction:column; gap:8px; margin:8px 0 }
.members-list { max-height:240px; overflow:auto; border:1px solid var(--line); border-radius:7px; margin:6px 0 10px }
.members-list label { display:flex; gap:8px; align-items:center; padding:8px 10px; margin:0; font-weight:400; color:var(--ink); font-size:14px; border-bottom:1px solid var(--line) }
#members-submit,#group-create,#invite-create { background:var(--blue); color:white; border:0; padding:9px 18px; border-radius:7px }
dialog .tabs { margin:6px 0 12px }

/* Invite dialog */
dialog { border:0; border-radius:12px; padding:20px 22px; width:min(480px,92vw); box-shadow:0 10px 40px #0003 }
dialog::backdrop { background:#17334b66 }
dialog h3 { margin:0 0 8px }
dialog .hint { font-size:13px; color:var(--muted); line-height:1.5; margin:0 0 12px }
dialog input,dialog select { width:100%; margin-bottom:10px }
#invite-links { display:flex; flex-direction:column; gap:8px; margin:6px 0 4px }
.link-row { display:flex; gap:8px; align-items:center } .link-row input { margin:0; flex:1; font-size:12px }
.link-row button { border:1px solid var(--line); background:white; color:var(--blue); padding:7px 10px; border-radius:6px; white-space:nowrap }

/* Medium widths: narrower columns, and the heading wraps its actions instead of overflowing. */
@media(max-width:1180px) and (min-width:901px) {
  main { grid-template-columns:120px 300px minmax(0,1fr) }
  .thread-heading { flex-wrap:wrap; padding:12px 16px }
  .who { flex:1 1 200px }
}

@media(max-width:900px) {
  /* Phone: list OR conversation, full screen each; «← Чаты» returns to the list. */
  main { display:flex; flex-direction:column }
  aside { flex:1; min-height:0; border-right:0 }
  .thread { display:none; flex:1; min-height:0 }
  body.in-thread aside,body.in-thread .rail { display:none }
  body.in-thread .thread { display:flex }
  /* The queue becomes one scrollable row above the list. */
  /* The queue at the bottom, under the thumb (ADR-013); above the iPhone's home bar. */
  .rail { order:2; flex-shrink:0; padding:6px 8px calc(6px + env(safe-area-inset-bottom)); overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch; scrollbar-width:none }
  .rail::-webkit-scrollbar { display:none }
  /* A tab bar: all six side by side across the screen, the count under its name. */
  .rail-tabs { flex-direction:row; justify-content:space-between; gap:2px }
  .rail [role=tab] { flex:1 1 auto; min-width:0; flex-direction:column; align-items:center; justify-content:flex-start; gap:2px; width:auto; padding:7px 3px 5px; font-size:11px; line-height:1.2; text-align:center; white-space:normal }
  .rail .rail-count { min-width:18px; padding:0 5px; font-size:11px }
  .rail [role=tab][aria-selected="true"]::before { left:10px; right:10px; top:2px; bottom:auto; width:auto; height:3px }
  /* A sideways finger move on a row is ours (swipes), an up-down one scrolls the list. */
  .dialog { touch-action:pan-y }
  .rail .rail-tasks { margin:0; border-top:0; border-radius:8px }
  .more-menu { right:12px; left:12px; top:100% }
  .back { display:inline-block }
  .brand { height:auto; flex-wrap:wrap; padding:8px 12px; gap:8px; row-gap:8px }
  .brand strong { display:none }
  .brand-actions { gap:6px }
  .brand .ghost { padding:6px 8px; font-size:12px }
  .find-open { order:3; flex-basis:100%; max-width:none; margin:0 }
  .search-clear { width:32px; height:32px; font-size:14px; right:6px }
  .thread-heading { flex-wrap:wrap; padding:10px 12px; gap:8px }
  .who { flex:1; min-width:0 }
  .thread-actions { flex-wrap:wrap; width:100% }
  .thread-actions button { padding:8px 10px; font-size:14px }
  .history,#composer { padding-left:12px; padding-right:12px }
  .context-panel { width:100% }
  .message { max-width:92% }
  .msg-delete,.msg-action { font-size:12px; padding:6px 0 }
  .dialog,.hit { padding:12px 10px }
  .pill.with-off { font-size:12px; padding:2px 3px 2px 8px }
  button.reply-off { width:20px; height:20px }
  button.reply-off::after { font-size:11px }
  #reply { min-height:48px }
  #composer { padding-top:8px; padding-bottom:10px }
  .composer-tools { margin-top:6px; gap:6px }
  .reply-row { gap:8px }
  #send { padding:10px 14px }
  /* An open chat takes the whole phone screen: no brand bar, one scrollable row of actions. */
  body.in-thread .brand { display:none }
  .thread-actions { flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; padding-bottom:2px }
  .thread-actions > * { flex-shrink:0 }
  /* Message actions live in the sheet a tap opens (ADR-020); «⋯» opens it from the keyboard. */
  .message .msg-actions { display:none }
  .msg-more { display:inline-block }
  /* A sideways finger move on a message is ours (swipe left to answer), an up-down one scrolls. */
  .message { touch-action:pan-y pinch-zoom; position:relative }
  #messages { overflow-x:clip; overflow-clip-margin:4px }  /* the «↩» of a message being swiped never widens the page */
  #connection { display:none }
  .send-bar { margin-top:6px }
  input,select,textarea { font-size:16px }  /* iOS zooms into smaller inputs */
  /* Task form: the whole screen, actions reachable without hover. */
  #task-dialog,#task-done-dialog { width:100vw; max-width:100vw; height:100dvh; max-height:100dvh; margin:0; border-radius:0 }
  .task-row { padding:10px 6px }
  .task-check { width:32px; height:32px }
  .msg-task button { padding:6px 4px }
}

/* File viewer: a file opens inside the hub, always with «Закрыть». Installed on a phone's home
   screen the hub has no browser bar — a plain link to a file left no way back (15.11.2026). */
dialog.viewer { width:min(1100px,96vw); height:min(860px,92dvh); max-width:none; max-height:none; padding:0; overflow:hidden }
dialog.viewer[open] { display:flex; flex-direction:column }
.viewer-bar { display:flex; align-items:center; gap:10px; padding:8px 12px; border-bottom:1px solid var(--line); background:white; flex-wrap:wrap }
.viewer-close { min-height:44px; padding:0 14px; border:1px solid var(--line); border-radius:10px; background:white; color:var(--ink); font-weight:600 }
.viewer-close:hover { background:#eef4f9 }
.viewer-title { flex:1 1 160px; min-width:0; display:flex; flex-direction:column }
.viewer-title strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.viewer-title .meta { margin:0 }
.viewer-actions { display:flex; gap:8px }
.viewer-actions .ghost { min-height:44px; display:inline-flex; align-items:center; text-decoration:none }
.viewer-body { flex:1; min-height:0; display:flex; align-items:center; justify-content:center; overflow:auto; background:#f3f5f7 }
.viewer-body img { max-width:100%; max-height:100%; object-fit:contain; display:block }
.viewer-body:has(iframe) { flex-direction:column; align-items:stretch }
.viewer-body iframe { flex:1; min-height:0; border:0; background:white }
.viewer-hint { margin:0; padding:8px 12px; font-size:13px; color:var(--ink); background:#fff6e5; border-bottom:1px solid var(--line) }
.viewer-note { max-width:420px; padding:24px; text-align:center; color:var(--muted); line-height:1.5 }
.viewer-note button { margin-top:12px }
#messages img { cursor:zoom-in }
@media (max-width:900px) {
  dialog.viewer { width:100vw; height:100dvh; margin:0; border-radius:0 }
  .viewer-bar { padding-top:max(8px, env(safe-area-inset-top)) }
  .viewer-actions { width:100% }
  .viewer-actions > * { flex:1; justify-content:center }
}

/* Search everywhere (Ctrl K), in a chat (Ctrl F), by date — search.js (15.11.2026) */
.find-open { flex:1; max-width:560px; margin-left:16px; display:flex; align-items:center; gap:8px; border:0; background:#2b4a63; color:#d5e1ea; border-radius:8px; padding:9px 12px; text-align:left }
.find-open:hover { background:#355873 }
.find-open kbd { margin-left:auto; font:inherit; font-size:12px; border:1px solid #5d7a92; border-radius:5px; padding:0 6px; color:#d5e1ea }
dialog.find { width:min(780px,96vw); height:min(760px,90dvh); max-width:none; max-height:none; margin-top:6vh; padding:0; overflow:hidden }
dialog.find[open] { display:flex; flex-direction:column }
.find-head { display:flex; align-items:center; gap:10px; padding:12px 16px; border-bottom:1px solid var(--line); color:var(--blue) }
dialog #find-q { flex:1; margin:0; border:0; font-size:18px; padding:6px 4px; color:var(--ink) }
.find-filters { display:flex; flex-wrap:wrap; gap:8px; align-items:center; padding:10px 16px 0 }
.find-kinds { display:flex; flex-wrap:wrap; gap:6px; flex:1 }
.find-kinds button { border:1px solid var(--line); background:white; color:var(--ink); border-radius:999px; padding:5px 11px; font-size:13px }
.find-kinds button[aria-pressed="true"] { background:var(--ink); border-color:var(--ink); color:white }
.find-count { font-variant-numeric:tabular-nums; opacity:.8 }
dialog #find-channel { width:auto; margin:0; font-size:13px }
.find-months { margin:10px 16px 0; padding:8px 10px 6px; background:var(--soft); border:1px solid var(--line); border-radius:10px }
.find-months-head { display:flex; justify-content:space-between; align-items:center; font-size:13px; margin-bottom:4px }
.find-reset { border:0; background:none; color:var(--blue); font-weight:600; font-size:13px; padding:2px 4px }
.find-bars { display:flex; align-items:flex-end; gap:3px; height:66px; overflow-x:auto }
.find-month { flex:1 0 30px; height:100%; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:3px; border:0; background:transparent; padding:2px; border-radius:6px; color:var(--muted) }
.find-month i { display:block; width:70%; max-width:26px; border-radius:3px 3px 0 0; background:#a9bfd6 }
.find-month span { font-size:10px; white-space:nowrap }
.find-month:hover:not(:disabled) { background:#e7eef4 }
.find-month[aria-pressed="true"] i { background:var(--blue) }
.find-month[aria-pressed="true"] span { color:var(--ink); font-weight:700 }
.find-month:disabled { opacity:1; cursor:default }
.find-month:disabled i { background:#dfe6ec }
.find-earlier { align-self:center; font-size:11px; color:var(--muted); white-space:nowrap; padding-right:6px }
.find-state { margin:10px 16px 0; font-size:13px; color:var(--muted) }
.find-state:empty { display:none }
.find-results { flex:1; min-height:0; overflow:auto; padding:2px 8px 12px }
.find-group { display:flex; justify-content:space-between; align-items:baseline; padding:12px 8px 4px }
.find-group h3 { margin:0; font-size:12px; font-weight:700; color:var(--muted) }
.find-all,.find-more { border:0; background:none; color:var(--blue); font-weight:600; font-size:13px; padding:4px 8px }
.find-row { display:flex; align-items:center; gap:6px }
#find .find-go { flex:1; min-width:0; display:grid; grid-template-columns:minmax(0,1fr); column-gap:10px; align-items:center; border:0; background:transparent; text-align:left; padding:8px; border-radius:8px; color:var(--ink) }
#find .find-files .find-go { grid-template-columns:40px minmax(0,1fr) }
#find .find-go:hover,#find .find-go:focus-visible { background:#eef4f9 }
.find-line,.find-sub { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.find-files .find-line,.find-files .find-sub { grid-column:2 }
.find-sub { font-size:12px; color:var(--muted) }
.find-ext { grid-row:span 2; width:40px; height:40px; display:grid; place-items:center; border-radius:8px; background:#e7eef6; color:var(--blue); font-size:10px; font-weight:700 }
#find mark { background:#fbe3a6; color:inherit; padding:0 1px; border-radius:2px }
.find-open-file { border:1px solid var(--line); background:white; color:var(--blue); border-radius:7px; padding:6px 10px; font-size:13px }
.chat-find { display:flex; flex-wrap:nowrap; align-items:center; gap:6px; padding:8px 24px; border-bottom:1px solid var(--line); background:white }
#chat-find-q { flex:1 1 120px; min-width:0 }
.chat-find-count { min-width:74px; font-size:13px; color:var(--muted); font-variant-numeric:tabular-nums }
.chat-find-step { width:36px; height:36px; border:1px solid var(--line); border-radius:8px; background:white; color:var(--blue); font-size:16px }
.chat-find-close { width:36px; height:36px; border:0; background:none; color:var(--muted); font-size:16px }
mark.chat-hit { background:#fbe3a6; color:inherit; padding:0 1px; border-radius:2px }
.history-wrap { flex:1; min-height:0; display:flex }
.history-wrap > .history { min-width:0 }
.ruler { flex:0 0 84px; display:flex; flex-direction:column; padding:8px 6px; border-left:1px solid var(--line); background:white; overflow:hidden }
.ruler-step { flex:1 1 0; min-height:2px; display:flex; align-items:center; gap:4px; border:0; background:transparent; padding:0 4px 0 2px; border-radius:3px; position:relative; line-height:1; color:var(--muted) }
.ruler-step:hover { background:#eef4f9 }
.ruler-step.here { background:#e3edf6; box-shadow:inset 0 0 0 2px var(--blue) }
.ruler-label { flex:0 0 34px; font-size:10px; text-align:left; white-space:nowrap }
.ruler-step i { display:block; height:3px; border-radius:2px; background:var(--blue); max-width:calc(100% - 46px) }
.ruler-step.with-hit::after { content:""; position:absolute; right:2px; top:50%; width:7px; height:7px; margin-top:-3.5px; border-radius:50%; background:#d97706 }
dialog.date-pick { width:min(440px,94vw) }
.date-head { display:flex; justify-content:space-between; align-items:center; gap:10px }
.date-head h3 { margin:0 }
.date-presets { display:flex; flex-wrap:wrap; gap:6px; margin:12px 0 }
.date-presets button,.date-month { border:1px solid var(--line); background:white; color:var(--ink); border-radius:999px; padding:6px 11px; font-size:13px; white-space:nowrap }
.date-months { display:flex; gap:6px; overflow-x:auto; padding:2px 0 10px }
.date-month[aria-pressed="true"] { background:var(--ink); border-color:var(--ink); color:white }
.date-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:4px; text-align:center }
.date-weekday { font-size:11px; color:var(--muted); padding:4px 0 }
.date-day { height:42px; border:0; border-radius:10px; background:#eef4f9; color:var(--ink); font-weight:600; position:relative }
.date-day:not(:disabled):hover { background:var(--blue); color:white }
.date-day:disabled { background:transparent; color:#97a3ad; font-weight:400; opacity:1 }
.date-day.today { box-shadow:inset 0 0 0 2px var(--blue) }
.date-day.with-hit::after { content:""; position:absolute; bottom:5px; left:50%; width:6px; height:6px; margin-left:-3px; border-radius:50%; background:#d97706 }
.date-legend { margin:10px 0 0 }
@media (max-width:900px) {
  dialog.find { width:100vw; height:100dvh; margin:0; border-radius:0 }
  .find-head { padding-top:max(12px, env(safe-area-inset-top)) }
  dialog.date-pick { width:100vw; max-width:none; margin:auto 0 0; border-radius:16px 16px 0 0; padding-bottom:max(20px, env(safe-area-inset-bottom)) }
  .chat-find { padding:8px 12px; flex-wrap:wrap }
  .ruler { display:none }
}

/* Reactions and marks to the contact (15.11.2026) */
.message .relay-note,.relay-note { margin:6px 0 0; font-size:12px; line-height:1.4; color:#4a3a1a; background:#fff6e5; border-radius:8px; padding:6px 9px }
.relay-confirm { margin-top:8px; padding:8px 10px; border-radius:10px; background:#fff6e5; display:flex; flex-wrap:wrap; gap:8px; align-items:center }
.message .relay-confirm p { margin:0; flex-basis:100%; font-size:13px }
.primary-small { border:0; background:var(--blue); color:white; border-radius:7px; padding:7px 12px; font-weight:600 }
.relay-toast { position:fixed; left:50%; bottom:24px; transform:translateX(-50%); z-index:20; display:flex; align-items:center; gap:14px; padding:10px 14px; border-radius:12px; background:#23272e; color:white; box-shadow:0 8px 24px #0004; max-width:calc(100vw - 32px) }
.relay-toast button { border:0; background:transparent; color:#ffc98a; font-weight:700; white-space:nowrap; font-variant-numeric:tabular-nums }
.msg-mark.their-reaction { background:#fff6e5; color:var(--ink); border-color:#f1dcb4 }
.relay-modes { display:flex; flex-direction:column; gap:6px; margin-top:6px }
.relay-mode { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:0; font-size:13px; color:var(--ink); font-weight:500 }
.relay-mode select { width:auto; margin:0 }
@media (max-width:900px) { .relay-toast { bottom:calc(16px + env(safe-area-inset-bottom)) } }

/* ======================================================================================
   «Стол» — redesign stage 3 (15.11.2026, owner chose variant C; ADR-019). ink.market's own
   look: Golos Text, its blue #2c6197 and orange #eb7e00, the warm white of the site, and the
   four inks of its logo for the four channels (Telegram cyan, MAX magenta, mail yellow, company
   chat black). One narrow column of icons, the list, the conversation. Later rules win: the
   older ones above stay for what is not restyled here.
   ====================================================================================== */
@font-face { font-family:"Golos Text"; src:url(/assets/golos-cyrillic.woff2) format("woff2"); font-weight:400 900; font-display:swap;
  unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116 }
@font-face { font-family:"Golos Text"; src:url(/assets/golos-latin.woff2) format("woff2"); font-weight:400 900; font-display:swap;
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD }
:root { --ink:#23272e; --muted:#5e6672; --line:#ece8e2; --blue:#2c6197; --navy:#17314f; --paper:#fff; --canvas:#fbfaf8; --soft:#fbfaf8;
  --orange:#eb7e00; --berry:#ae2c52; --max:#8a2462; font-family:"Golos Text","Segoe UI",system-ui,sans-serif }
body { background:var(--canvas) }
:focus-visible { outline:3px solid var(--blue); outline-offset:2px }
input,select,textarea { border-color:#dcd7cf; border-radius:10px }
.ghost { border-radius:10px }
dialog { border-radius:16px }

/* The logo: four drops of ink */
.logo { display:inline-grid; grid-template-columns:9px 9px; gap:3px; flex-shrink:0 }
.logo i { width:9px; height:9px; border-radius:50% }
.logo i:nth-child(1) { background:#1c8fcc } .logo i:nth-child(2) { background:#c2398a } .logo i:nth-child(3) { background:#e8b400 } .logo i:nth-child(4) { background:#23272e }
.rail .logo i:nth-child(4) { background:#fff }
.login-brand strong span,.aside-title span { font-weight:400; color:var(--muted) }

/* Columns: icons, list, conversation (and the contact panel on wide screens) */
main { grid-template-columns:80px 340px minmax(0,1fr) }
main.with-panel { grid-template-columns:80px 340px minmax(0,1fr) 320px }

/* The icon column: dark blue of the site's top bar */
.rail { background:var(--navy); padding:14px 6px 10px; display:flex; flex-direction:column; gap:12px }
.rail > .logo { align-self:center; margin-bottom:4px }
.rail-tabs { gap:4px }
.rail [role=tab],.rail-settings { display:flex; flex-direction:column; align-items:center; gap:3px; width:100%; border:0; background:transparent; color:#b8c7d6;
  padding:8px 2px 7px; border-radius:12px; font-size:10.5px; line-height:1.15; text-align:center; position:relative; font-weight:500 }
.rail [role=tab]:hover,.rail-settings:hover { background:#22405f; color:#fff }
.rail [role=tab][aria-selected="true"] { background:var(--blue); color:#fff; font-weight:600 }
.rail [role=tab][aria-selected="true"]::before { display:none }
.rail-icon { display:grid; place-items:center; height:22px }
/* «Непрочитанные» is wider than the column: broken by syllables, never cut. */
.rail-label { max-width:100%; overflow-wrap:anywhere; hyphens:auto; -webkit-hyphens:auto }
.rail .rail-count,.rail .rail-count.urgent,.rail .tab-count { position:absolute; top:2px; right:4px; min-width:18px; height:18px; padding:0 5px; border-radius:999px;
  background:var(--orange); color:var(--ink); font-size:11px; font-weight:700; line-height:18px; text-align:center }
.rail .tab-count.overdue { background:var(--berry); color:#fff }
.rail .rail-tasks { margin-top:0; border-top:0; border-radius:12px }
/* Blue on the dark blue column is barely seen: the site's light peach instead (over 3:1). */
.rail :focus-visible { outline-color:#ffc98a }
.rail-settings { margin-top:auto }

/* The list: a light head instead of the old dark bar */
aside { padding:12px 12px 10px; background:#fff; border-right:1px solid var(--line) }
.aside-head.brand { height:auto; padding:2px 2px 10px; background:transparent; color:var(--ink); gap:8px; flex-shrink:0 }
.aside-title { font-size:17px; font-weight:700; letter-spacing:-.01em; white-space:nowrap }
.brand-actions { margin-left:auto; display:flex; gap:2px }
.icon-btn { width:36px; height:36px; display:grid; place-items:center; border:0; background:transparent; color:var(--muted); border-radius:10px; padding:0 }
.icon-btn:hover { background:#f0ede8; color:var(--ink) }
.find-open { flex:none; max-width:none; margin:0 0 10px; background:#f3f1ed; color:var(--muted); border-radius:10px; padding:10px 12px }
.find-open:hover { background:#ece8e2 }
.find-open kbd { border-color:#d6d0c6; color:var(--muted) }
.folders button { border-color:#e3dfd8; color:#4a515c; border-radius:999px; padding:4px 10px }
.folders button[aria-pressed="true"] { background:var(--ink); border-color:var(--ink); color:#fff }
.folders button[aria-pressed="true"] .chip-count { background:#fff; color:var(--ink) }
.chip-count { background:var(--orange); color:var(--ink); font-weight:700 }
#search { border-radius:10px }
.dialog { border-radius:12px; padding:8px 10px }
.dialog:hover,.hit:hover { background:#f5f3ef }
.dialog.selected { background:#e8eff6; box-shadow:none }
.dialog strong { font-size:14.5px; font-weight:600 }
.badge { font-size:10.5px; font-weight:700; border-radius:6px; padding:1px 5px; background:#e0f0f9; color:#14668f }
.badge.max { background:#f4e3ee; color:#8a2462 } .badge.email { background:#f8efd2; color:#6f5300 } .badge.hub { background:#e9e7e3; color:var(--ink) } .badge.pricebridge { background:#ece4f6; color:#5b2d8c }
.unread-count { background:var(--orange); color:var(--ink); font-weight:700 }
.list-pages button { border-radius:8px }

/* The conversation */
.thread-heading { padding:12px 20px; background:#fff }
.thread-heading h2 { font-size:18px; font-weight:600 }
.thread-actions button { border-radius:10px; font-size:14px }
.thread-actions button:hover:not(:disabled) { background:#f0ede8 }
.thread-actions button.primary { background:var(--blue); border-radius:10px }
.thread-actions button.primary:hover { background:#24527f }
#more-toggle { border-color:#e3dfd8 }
.history { background:var(--canvas) }
#messages { gap:10px }
.message { border-color:#ece8e2; border-radius:16px 16px 16px 4px; padding:9px 14px 8px }
.message.outgoing { background:#e6eef7; border-color:#d7e3f0; border-radius:16px 16px 4px 16px }
.message p { line-height:1.5 }
.message.found,.message.flash { box-shadow:0 0 0 2px var(--orange) }
.quote { border-left-color:var(--blue); background:#f3f1ed; border-radius:6px }
.message.outgoing .quote { background:#d9e5f2 }
.attachment { font-weight:500 }
.msg-mark { border-radius:999px }
.mark-picker button { border-radius:999px }
.mark-picker button[aria-pressed="true"] { background:#245c33; border-color:#245c33 }
/* A computer: the actions of a message come up under the pointer or the keyboard; their place
   is kept, so nothing moves when they appear. A phone keeps the tap (show-actions). */
@media (min-width:901px) and (hover:hover) {
  .message .msg-actions { opacity:0; transition:opacity .12s }
  .message:hover .msg-actions,.message:focus-within .msg-actions,.message.show-actions .msg-actions { opacity:1 }
}
@media (prefers-reduced-motion:reduce) { .message .msg-actions { transition:none } }

/* The answer field */
#composer { padding:10px 20px 14px; background:#fff }
#reply { border-color:#e3dfd8; border-radius:14px; padding:11px 14px; font-size:15px }
#reply:focus { border-color:var(--blue); box-shadow:0 0 0 3px rgba(44,97,151,.15); outline:none }
.attach { border-radius:10px; border-color:#e3dfd8 }
#send { border-radius:10px; font-weight:600 }
.quiet { border-radius:10px; border-color:#e3dfd8 }

/* Login: the same mark and type */
.login-brand .logo { margin-right:2px }
#login-submit { border-radius:10px }

@media (max-width:900px) {
  /* Phone: the icon column is the tab bar at the bottom (ADR-013). */
  .rail { flex-direction:row; align-items:stretch; gap:2px; padding:4px 6px calc(4px + env(safe-area-inset-bottom)) }
  .rail > .logo { display:none }
  .rail-tabs { flex:1 }
  .rail [role=tab],.rail-settings { padding:4px 1px 3px; gap:2px; font-size:10px; line-height:1.05 }
  .rail-icon { height:20px }
  /* Two lines at most under the thumb: the bar stays low. */
  .rail-label { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden }
  .rail-settings { margin-top:0; flex:0 0 auto; width:auto; min-width:56px }
  .rail .rail-count,.rail .rail-count.urgent,.rail .tab-count { top:0; right:2px }
  .aside-head strong { display:block }
  .find-open { order:0; flex-basis:auto }
  .thread-heading { padding:10px 12px }
  #composer { padding:8px 12px 10px }
  #reply { font-size:16px }  /* less than 16 px and iPhone zooms the page on focus */
  .dialog { padding:12px 10px }  /* rows stay tall enough for a finger and a swipe */
}

/* ---------- Phone: the message sheet and swipe to answer (15.11.2026, ADR-020) ---------- */
dialog.sheet { margin:auto 0 0; width:100vw; max-width:100vw; max-height:85dvh; padding:8px 16px calc(12px + env(safe-area-inset-bottom));
  border:0; border-radius:18px 18px 0 0; background:var(--canvas, #fbfaf8); color:var(--ink); overflow-y:auto; overscroll-behavior:contain }
dialog.sheet::backdrop { background:rgba(23,49,79,.38) }
dialog.sheet[open] { animation:sheet-up .18s ease-out }
@keyframes sheet-up { from { transform:translateY(24px) } to { transform:none } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation:none } }
.sheet-grip { width:40px; height:4px; border-radius:2px; background:#d6d0c7; margin:2px auto 10px }
.sheet-title { margin:0 0 10px; color:#5d6470; font-size:14px; line-height:1.35; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden }
.sheet-reactions { display:flex; justify-content:space-between; gap:4px; background:white; border:1px solid #ece8e2; border-radius:14px; padding:6px }
.sheet-reactions button { flex:1 1 0; min-width:0; min-height:44px; border:0; border-radius:10px; background:none; font-size:22px; line-height:1 }
.sheet-reactions button[aria-pressed="true"] { background:#e5ecf4; box-shadow:inset 0 0 0 2px var(--blue, #2c6197) }
dialog.sheet .relay-note { margin:6px 2px 12px; font-size:12.5px; color:#5d6470 }
.sheet-actions { display:flex; flex-direction:column; background:white; border:1px solid #ece8e2; border-radius:14px; overflow:hidden }
.sheet-action { display:block; width:100%; min-height:50px; padding:0 16px; border:0; border-bottom:1px solid #f0ece6; background:white; color:var(--ink); font:inherit; font-size:16px; text-align:left }
.sheet-action:last-child { border-bottom:0 }
.sheet-action:active,.sheet-reactions button:active { background:#eef3f8 }
.sheet-action.danger { margin-top:12px; border:1px solid #ece8e2; border-radius:14px; color:var(--berry, #ae2c52) }
.sheet-marks { margin-top:12px }
.sheet-label { margin:0 2px 6px; font-size:13px; font-weight:600; color:#5d6470 }
dialog.sheet .mark-picker { display:flex; flex-wrap:wrap; gap:8px }
dialog.sheet .mark-picker button { min-height:44px; padding:0 14px; font-size:15px }
.sheet-close { display:block; width:100%; min-height:48px; margin-top:12px; border:0; border-radius:14px; background:#ece8e2; color:var(--ink); font:inherit; font-size:16px; font-weight:600 }
dialog.sheet :focus-visible { outline:2px solid var(--blue, #2c6197); outline-offset:2px }
.sheet-action:focus-visible { outline-offset:-3px }  /* .sheet-actions clips anything outside */
.sheet-undo { display:flex; align-items:center; gap:10px; margin-bottom:10px; padding:8px 12px; border-radius:12px; background:#17314f; color:white; font-size:14px }
.sheet-undo span { flex:1 }
.sheet-undo button { min-height:40px; color:white; border-color:rgba(255,255,255,.5); background:none }
/* Swipe to answer: the message follows the finger, «↩» shows up on its right. */
.message[data-swipe] { transform:translateX(var(--swipe, 0px)) }
.message[data-swipe]::after { content:"↩"; position:absolute; right:-44px; top:50%; transform:translateY(-50%); width:32px; height:32px; border-radius:50%;
  display:grid; place-items:center; background:#e5ecf4; color:var(--blue, #2c6197); font-size:17px; opacity:.45 }
.message.swipe-ready::after { opacity:1; background:var(--blue, #2c6197); color:white }

/* ---------- The «PriceBridge» chat pinned above the list (18.11.2026, ADR-027) ---------- */
/* Not a row of the list: folders, the name search, queues and pages never hide it. Its own
   mark (a bridge on PriceBridge's violet), «закреплён» in words, unread as on every chat. */
.pb-pin { display:flex; align-items:center; gap:10px; width:100%; flex-shrink:0; margin:0 0 10px; padding:8px 10px; border:1px solid #e4dcef;
  border-radius:12px; background:#f7f3fb; color:var(--ink); text-align:left; font:inherit; cursor:pointer }
.pb-pin[hidden] { display:none }
.pb-pin:hover { background:#f0e9f7 }
.pb-pin.selected { background:#ece4f6; border-color:#5b2d8c; box-shadow:inset 3px 0 #5b2d8c }
.pb-pin:focus-visible { outline:2px solid #5b2d8c; outline-offset:2px }
.pb-pin[aria-disabled="true"] { cursor:default; opacity:.6 }
.pb-icon { flex:0 0 36px; width:36px; height:36px; border-radius:10px; display:grid; place-items:center; background:#5b2d8c; color:#fff }
.pb-body { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px }
.pb-head { display:flex; align-items:center; gap:6px; min-width:0 }
.pb-head strong { font-size:14.5px; font-weight:600; white-space:nowrap }
.pb-tag { font-size:10.5px; font-weight:700; border-radius:6px; padding:1px 5px; background:#ece4f6; color:#5b2d8c }
.pb-pin .time { margin-left:auto; flex-shrink:0; font-size:11px; color:var(--muted) }
.pb-line { display:flex; flex-wrap:wrap; align-items:center; gap:4px 6px; min-width:0; font-size:13px; color:var(--muted) }
.pb-line .preview { flex:1 1 120px; min-width:0; margin:0 }  /* pills first; a long row of them wraps, never overflows */
.pb-pills { display:contents }
@media (max-width:900px) {
  .pb-pin { padding:12px 10px }  /* as tall as a list row under a finger */
}

/* ---------- The alarm: reminders and task due times ring (23.11.2026, ADR-028) ---------- */
dialog.alarm { width:min(560px, calc(100vw - 32px)); max-height:85dvh; overflow-y:auto; padding:18px 20px 14px; border:0; border-radius:18px;
  border-top:6px solid var(--orange, #eb7e00); box-shadow:0 18px 60px rgba(23,49,79,.35) }
dialog.alarm::backdrop { background:rgba(23,49,79,.45) }
dialog.alarm[open] { animation:alarm-in .2s ease-out }
@keyframes alarm-in { from { transform:scale(.96); opacity:0 } to { transform:none; opacity:1 } }
@keyframes alarm-shake { 0%,100% { transform:rotate(0) } 20% { transform:rotate(-14deg) } 40% { transform:rotate(12deg) } 60% { transform:rotate(-8deg) } 80% { transform:rotate(5deg) } }
.alarm-head { display:flex; align-items:center; gap:10px; margin-bottom:12px }
.alarm-bell { font-size:30px; line-height:1; display:inline-block; animation:alarm-shake 1s ease-in-out 3 }
.alarm-head h3 { margin:0; font-size:20px; font-weight:700 }
.alarm-head h3:focus { outline:none }
.alarm-list { display:flex; flex-direction:column; gap:10px }
.alarm-item { border:1px solid #f1dcc0; background:#fff8ef; border-radius:14px; padding:12px 14px }
.alarm-what { display:flex; flex-direction:column; gap:2px }
.alarm-what strong { font-size:16px; font-weight:600; overflow-wrap:anywhere }
.alarm-what .meta { font-size:13px; color:var(--muted) }
.alarm-note { margin:6px 0 0; font-size:15px; line-height:1.4; white-space:pre-wrap; overflow-wrap:anywhere }
.alarm-actions { display:flex; flex-wrap:wrap; gap:6px; margin-top:10px }
.alarm-actions button { border-radius:10px; padding:7px 12px; font-size:14px }
.alarm-actions button.primary { margin-left:auto; background:var(--blue); border:1px solid var(--blue); color:#fff; font-weight:600 }
.alarm-actions button.primary:hover:not(:disabled) { background:#24527f }
.alarm-push { margin:12px 0 0; padding:10px 12px; border-radius:12px; background:#eef3f8; font-size:13.5px; line-height:1.45 }
.alarm-push button { margin-top:6px; display:block }
dialog.alarm .card-bar { margin-top:12px; align-items:center }
@media (prefers-reduced-motion: reduce) { dialog.alarm[open],.alarm-bell { animation:none } }
@media (max-width:900px) {
  dialog.alarm { width:100vw; max-width:100vw; margin:auto 0 0; border-radius:18px 18px 0 0; padding-bottom:calc(14px + env(safe-area-inset-bottom)) }
  .alarm-actions button { min-height:44px; flex:1 1 40% }
  .alarm-actions button.primary { margin-left:0; flex-basis:100% }
}

/* ---------- Files of a task (23.11.2026, ADR-029) ---------- */
.task-files { margin:10px 0 4px; display:flex; flex-direction:column; gap:6px }
.task-files-label { font-size:13px; font-weight:600; color:var(--ink) }
.task-file-list { display:flex; flex-direction:column; gap:4px }
.task-file-list:empty { display:none }
.task-file { display:flex; align-items:center; gap:8px; min-width:0; padding:6px 8px; border:1px solid #ece8e2; border-radius:10px; background:#fbfaf8 }
.task-file-open { flex:1; min-width:0; border:0; background:none; padding:0; color:var(--blue); font:inherit; font-size:14px; text-align:left; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; cursor:pointer }
.task-file-name { flex:1; min-width:0; font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.task-file .meta { flex-shrink:0; font-size:12px }
.task-file-remove { flex-shrink:0; width:28px; height:28px; border:0; border-radius:50%; background:none; color:var(--muted); font-size:15px; line-height:1 }
.task-file-remove:hover { background:#f0ede8; color:var(--berry, #ae2c52) }
.task-attach { display:flex; align-items:center; gap:8px; flex-wrap:wrap }
.task-files-count { color:var(--muted); font-size:12px; white-space:nowrap }
@media (max-width:900px) { .task-file-remove { width:40px; height:40px } }
