/* The chat: the dock over the pages (the CHAT DOCK block of docs/design/evico/evico.css), the „Mesaje” pages and the phone's screens.
   Colours, radii and shadows come from tokens.css, the controls from blocks.css. */

/* chat.js keeps the place of what is read, and turns the browser's own anchoring off while it does. */


/* ---------- Dock: launcher, windows, minimised conversations, the floating button ---------- */

.chat-slot { position: fixed; right: 24px; bottom: 24px; z-index: 30; pointer-events: none; }
.chat-slot > .chat-dock > *, .chat-slot.fill > .chat-dock { pointer-events: auto; }
.chat-slot.fill { inset: 0; z-index: 60; }
.chat-slot.phone-slot { right: 16px; bottom: auto; z-index: 45; visibility: hidden; }
.chat-slot.phone-slot .chat-head { touch-action: none; user-select: none; -webkit-user-drag: none; }
main.has-chat .page, main.has-chat.phone-main { padding-bottom: 104px; }
/* The button, the minimised heads and their preview stand 16 px above an action bar stuck to the bottom (its height is --bar-height); where it is
   not stuck, their own place. An open window keeps its place: it was opened on purpose and may cover the page. */
@media (min-width: 641px) { .chat-slot:not(.phone-slot) .chat-rail { margin-bottom: max(0px, calc(var(--bar-height, 0px) + 16px - 24px)); } }
.chat-dock { display: flex; align-items: flex-end; justify-content: flex-end; gap: 16px; font-family: var(--ev-font); font-size: 16px; line-height: 1.55; color: var(--ev-text); }
.chat-dock.fill { width: 100%; height: 100%; }
.chat-dock p { margin: 0; }
.chat-dock a { color: inherit; text-decoration: none; }
.chat-dock button { font-family: var(--ev-font); }
.chat-dock button:focus-visible, .chat-dock a:focus-visible, .chat-dock textarea:focus-visible, .chat-dock input:focus-visible { outline: 2px solid var(--ev-ink); outline-offset: 2px; box-shadow: none; }
.chat-dock label:has(input:focus-visible) { outline: 2px solid var(--ev-ink); outline-offset: 2px; }
.chat-icon { flex: 0 0 auto; }
.chat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.chat-rail { flex: 0 0 56px; width: 56px; display: grid; gap: 12px; justify-items: center; }
.chat-pos { position: relative; display: grid; }
.chat-launcher { width: 56px; height: 56px; padding: 0; display: grid; place-items: center; border: 0; border-radius: var(--ev-pill); background: var(--ev-ink); color: var(--ev-on-ink); box-shadow: var(--ev-shadow-md); cursor: pointer; }
.chat-head { width: 48px; height: 48px; padding: 0; display: grid; place-items: center; border: 2px solid var(--ev-surface); border-radius: var(--ev-pill); background: var(--ev-primary-soft); color: var(--ev-primary-ink); font-size: 14px; font-weight: 600; box-shadow: var(--ev-shadow-md); cursor: pointer; }
.chat-head.big { width: 56px; height: 56px; font-size: 16px; font-weight: 700; touch-action: none; }
.chat-count { position: absolute; top: -6px; right: -6px; min-width: 24px; height: 24px; padding: 0 6px; display: grid; place-items: center; border: 2px solid var(--ev-surface); border-radius: var(--ev-pill); background: var(--ev-primary-soft); color: var(--ev-primary-ink); font-size: 13px; line-height: 1; font-weight: 700; pointer-events: none; }
.chat-count.ink { background: var(--ev-ink); color: var(--ev-on-ink); }

.chat-peek { position: absolute; right: calc(100% + 12px); bottom: 0; width: 288px; display: flex; align-items: flex-start; background: var(--ev-surface); border: 1px solid var(--ev-border); border-radius: var(--ev-radius); box-shadow: var(--ev-shadow-md); }
.chat-peek.phone-peek { width: 264px; }
.on-left .chat-peek { right: auto; left: calc(100% + 12px); }
.chat-peek-open { flex: 1 1 0; min-width: 0; min-height: 56px; padding: 10px 14px; display: grid; gap: 2px; border: 0; border-radius: var(--ev-radius); background: transparent; color: var(--ev-text); text-align: left; cursor: pointer; }
.chat-peek-open strong { font-size: 14px; line-height: 1.4; font-weight: 600; }
.chat-peek-open span { font-size: 14px; line-height: 1.4; font-weight: 400; color: var(--ev-text-2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.chat-peek .iconbtn { flex: 0 0 auto; }
.chat-win { flex: 0 0 auto; width: 360px; height: 520px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; background: var(--ev-surface); border: 1px solid var(--ev-border); border-radius: 18px; box-shadow: var(--ev-shadow-md); text-align: left; }
.chat-win.full { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
.chat-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 12px; border-bottom: 1px solid var(--ev-border); }
.chat-win.full .chat-bar { padding: 8px 8px 8px 4px; gap: 8px; }
.chat-bar .iconbtn { flex: 0 0 auto; }
.chat-tools { flex: 0 0 auto; display: flex; }
.chat-who { flex: 1 1 0; min-width: 0; display: grid; }
.chat-who strong { font-size: 14px; line-height: 1.4; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-who span { font-size: 13px; line-height: 1.45; color: var(--ev-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-win.full .chat-who strong { font-size: 16px; font-weight: 700; }
.chat-title { flex: 1 1 0; min-width: 0; margin: 0; font-size: 20px; line-height: 1.3; font-weight: 700; }
.chat-context { flex: 0 0 auto; display: flex; gap: 8px; align-items: center; padding: 6px 16px; background: var(--ev-surface-2); font-size: 13px; line-height: 1.45; color: var(--ev-text-2); }
.chat-banner { flex: 0 0 auto; display: flex; gap: 8px; align-items: center; padding: 8px 16px; background: var(--ev-warning-soft); color: var(--ev-warning-ink); font-size: 14px; line-height: 1.4; font-weight: 600; }
.chat-scroll { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column-reverse; overflow-x: hidden; overflow-y: auto; }
.chat-log { list-style: none; margin: 0; padding: 12px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.chat-day { text-align: center; font-size: 13px; line-height: 1.45; color: var(--ev-muted); }
.chat-new { display: flex; align-items: center; gap: 12px; font-size: 13px; line-height: 1.45; color: var(--ev-primary-ink); }
.chat-new::before, .chat-new::after { content: ""; flex: 1 1 0; height: 1px; background: var(--ev-border-strong); }
.chat-msg { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.chat-msg.mine { justify-items: end; }
.chat-msg > .action-error { margin: 0; }
.chat-line { position: relative; display: flex; gap: 4px; align-items: center; max-width: 100%; }
.chat-more { opacity: 0; flex: 0 0 44px; color: var(--ev-muted); }
.chat-msg:hover .chat-more, .chat-more:focus-visible, .chat-more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .chat-more { opacity: 1; } }
.chat-bubble { min-width: 0; max-width: 264px; padding: 10px 14px; display: grid; gap: 8px; border-radius: 16px 16px 16px 4px; background: var(--ev-surface-2); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-bubble p, .chat-item-bubble p, .chat-phone-bubble p { white-space: pre-line; }
.mine .chat-bubble { border-radius: 16px 16px 4px 16px; background: var(--ev-ink); color: var(--ev-on-ink); }
.mine .chat-bubble.edited { outline: 2px solid var(--ev-primary-ink); outline-offset: 2px; }
.chat-win.full .chat-bubble { max-width: 300px; font-size: 16px; }
.chat-meta { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; line-height: 1.45; color: var(--ev-muted); }
.chat-file { width: 232px; max-width: 100%; min-height: 48px; display: flex; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--ev-border); border-radius: var(--ev-radius-sm); background: var(--ev-surface); color: var(--ev-text); font-family: var(--ev-font); text-align: left; cursor: pointer; }
.chat-file > span { flex: 1 1 0; min-width: 0; display: grid; font-size: 14px; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }
.chat-file > span > span { font-size: 13px; font-weight: 400; color: var(--ev-muted); }
span.chat-file { cursor: default; }
.chat-gone { padding: 8px 14px; border: 1px dashed var(--ev-border-strong); border-radius: 16px; font-size: 14px; line-height: 1.4; color: var(--ev-muted); }
.chat-typing { flex: 0 0 auto; padding: 0 16px 8px; font-size: 13px; line-height: 1.45; color: var(--ev-muted); }
.chat-form { flex: 0 0 auto; display: grid; padding: 8px; border-top: 1px solid var(--ev-border); background: var(--ev-surface); }
.chat-write { display: flex; gap: 4px; align-items: flex-end; }
.chat-write textarea { flex: 1 1 0; min-width: 0; min-height: 48px; max-height: 120px; padding: 11px 14px; border: 1px solid var(--ev-border-strong); border-radius: var(--ev-radius); background: var(--ev-surface); color: var(--ev-text); font: 400 16px/1.5 var(--ev-font); resize: none; field-sizing: content; }
.chat-send { flex: 0 0 48px; width: 48px; height: 48px; padding: 0; display: grid; place-items: center; border: 0; border-radius: var(--ev-radius); background: var(--ev-ink); color: var(--ev-on-ink); cursor: pointer; }
.chat-send[disabled] { opacity: .5; cursor: default; }
.chat-form .iconbtn { flex: 0 0 44px; }
.chat-write .iconbtn { height: 48px; }
.chat-form .action-error { margin: 8px 0 0; }
.chat-attach { position: relative; cursor: pointer; }
.chat-attach:focus-within { outline: 2px solid var(--ev-ink); outline-offset: 2px; }
.chat-chip { display: flex; gap: 8px; align-items: center; margin: 0 0 8px; padding-left: 12px; border: 1px solid var(--ev-border-strong); border-radius: var(--ev-radius); font-size: 14px; line-height: 1.4; }
.chat-chip > span { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.chat-menu { position: absolute; z-index: 2; right: 0; top: calc(100% + 4px); width: 208px; margin: 0; padding: 8px; list-style: none; background: var(--ev-surface); border: 1px solid var(--ev-border); border-radius: var(--ev-radius); box-shadow: var(--ev-shadow-md); }
.chat-msg:not(.mine) .chat-menu { right: auto; left: 0; }
.chat-menu.up { top: auto; bottom: calc(100% + 4px); }
.chat-head-options { position: relative; display: flex; }
.chat-head-options .chat-menu { z-index: 5; width: 280px; }
.chat-menu button, .chat-dock .chat-menu a { width: 100%; min-height: 44px; display: flex; gap: 10px; align-items: center; padding: 0 10px; border: 0; border-radius: var(--ev-radius-sm); background: transparent; color: var(--ev-text); font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.chat-menu button:hover, .chat-dock .chat-menu a:hover { background: var(--ev-surface-2); }
.chat-menu button.bad { color: var(--ev-danger-ink); }
.chat-search { flex: 0 0 auto; padding: 12px 12px 4px; }
.chat-search input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--ev-border-strong); border-radius: var(--ev-radius); background: var(--ev-surface); color: var(--ev-text); font: 400 16px/1.4 var(--ev-font); }
.chat-list { flex: 1 1 0; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 4px 8px 8px; }
.chat-row { width: 100%; display: flex; gap: 12px; align-items: flex-start; padding: 12px 8px; border: 0; border-radius: var(--ev-radius); background: transparent; color: var(--ev-text); text-align: left; cursor: pointer; }
.chat-row:hover { background: var(--ev-surface-2); }
.chat-row-main { flex: 1 1 0; min-width: 0; display: grid; gap: 2px; }
.chat-row-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.chat-row-top strong, .chat-row-text, .chat-row-sub { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row-top strong { font-size: 14px; line-height: 1.4; font-weight: 600; }
.chat-row-top time, .chat-row-sub { font-size: 13px; line-height: 1.45; color: var(--ev-muted); white-space: nowrap; }
.chat-row-text { font-size: 14px; line-height: 1.4; font-weight: 400; color: var(--ev-text-2); }
.chat-row-text.unread { font-weight: 600; color: var(--ev-text); }
.chat-note { flex: 1 1 0; display: grid; align-content: center; justify-items: center; text-align: center; gap: 8px; padding: 24px; font-size: 14px; line-height: 1.5; color: var(--ev-text-2); }
.chat-note strong { font-size: 16px; line-height: 1.4; font-weight: 700; color: var(--ev-text); }
.chat-note .btn { margin-top: 8px; }
.chat-note-icon { display: grid; color: var(--ev-primary-ink); }
.chat-note-icon.warn { color: var(--ev-warning-ink); }
.chat-list-shapes { flex: 1 1 0; padding: 8px; }
.chat-row-shape { display: flex; gap: 12px; padding: 12px 8px; }
.chat-row-shape .skel.tile { width: 40px; height: 40px; }
.chat-row-shape > span:last-child { flex: 1 1 0; display: grid; gap: 8px; align-content: center; }
.chat-row-shape .skel:not(.tile) { width: 62%; }
.chat-row-shape .skel.thin { width: 46%; }
.chat-row-shape:nth-child(2) .skel:not(.tile) { width: 48%; }
.chat-row-shape:nth-child(2) .skel.thin { width: 32%; }
.chat-row-shape:nth-child(3) .skel:not(.tile) { width: 70%; }
.chat-row-shape:nth-child(3) .skel.thin { width: 54%; }
.chat-foot { flex: 0 0 auto; display: grid; gap: 12px; padding: 12px; border-top: 1px solid var(--ev-border); }
.chat-foot .callout { margin: 0; padding: 12px 14px; }
.chat-skel { flex: 1 1 0; display: grid; gap: 12px; align-content: end; justify-items: start; padding: 16px; }
.chat-skel i { display: block; width: 200px; height: 44px; border-radius: 16px; background: var(--ev-surface-3); }
.chat-skel i.r { justify-self: end; width: 160px; }
.chat-skel.tall { min-height: 320px; padding: 24px; }
@media (max-width: 640px) { .chat-dock .btn-sm { width: auto; } }
@media (prefers-reduced-motion: no-preference) {
    .chat-win:not(.full), .chat-peek { animation: chat-in .16s ease-out; }
    @keyframes chat-in { from { opacity: 0; transform: translateY(8px); } }
}

/* ---------- A picture open over the page: a dialog on the web, the whole screen on a phone and up to 640px ---------- */

.pic-slot { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 24px; border: 0; box-sizing: border-box; display: none; place-items: center; overflow: hidden; background: var(--ev-scrim); color: var(--ev-text); font-family: var(--ev-font); font-size: 16px; line-height: 1.5; }
.pic-slot[open] { display: grid; }
.pic-slot::backdrop { background: transparent; }
.pic { width: min(960px, 100%); height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--ev-surface); border-radius: var(--ev-radius-lg); box-shadow: var(--ev-shadow-md); }
.pic-slot.full { padding: 0; }
.pic-slot.full .pic { width: 100%; border-radius: 0; box-shadow: none; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); box-sizing: border-box; }
.pic-bar { flex: 0 0 auto; display: flex; gap: 8px; align-items: center; min-height: 64px; padding: 8px 8px 8px 24px; border-bottom: 1px solid var(--ev-border); box-sizing: border-box; }
.pic-slot.full .pic-bar { padding: 8px 12px 8px 4px; }
.pic-bar .iconbtn, .pic-bar .btn, .pic-bar .saved { flex: 0 0 auto; }
.pic-name { flex: 1 1 0; min-width: 0; display: grid; }
.pic-name strong { font-size: 16px; line-height: 1.4; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pic-name span { font-size: 13px; line-height: 1.45; color: var(--ev-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pic .btn-sm { width: auto; min-height: 44px; }
.pic > .action-error { margin: 0; border-radius: 0; }
.pic-view { flex: 1 1 0; min-height: 0; min-width: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; padding: 16px; background: var(--ev-surface-2); overflow: auto; overscroll-behavior: contain; }
.pic-slot.full .pic-view { padding: 0; touch-action: pan-x pan-y; }
.pic-view > img { max-width: 100%; max-height: 100%; cursor: zoom-in; }
.pic-view.large { grid-template: auto / auto; place-content: safe center; place-items: start; }
.pic-view.large > img { max-width: none; max-height: none; cursor: zoom-out; }
.pic-slot.full .pic-view > img { cursor: default; }
.pic-view .skel { width: 320px; height: 220px; border-radius: var(--ev-radius); }
.pic-note { display: grid; justify-items: center; gap: 8px; max-width: 360px; text-align: center; font-size: 14px; color: var(--ev-text-2); }
.pic-note p { margin: 0; }
.pic-note strong { font-size: 16px; color: var(--ev-text); }
.pic-note .btn { margin-top: 8px; }
.pic-warning { display: grid; color: var(--ev-warning-ink); }

/* On black a shadow says nothing: what floats gets a line. */
@media (prefers-color-scheme: dark) { .pic-slot:not(.full) .pic { border: 1px solid var(--ev-border-strong); } }

/* ---------- A state alone in its place, and the search in a conversation ---------- */

.empty.lone { min-height: 320px; align-content: center; justify-items: center; text-align: center; box-sizing: border-box; }
.empty.lone p { max-width: 440px; text-wrap: balance; }
.empty.lone > .empty-actions { justify-content: center; }
.chat-find { display: grid; gap: 8px; padding: 16px 24px; border-bottom: 1px solid var(--ev-border); background: var(--ev-bg); }
.chat-find p { margin: 0; }
.chat-find .action-error { margin: 0; }
.chat-find-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.chat-find-row .field { flex: 1 1 240px; }
.chat-find-steps { display: flex; gap: 4px; align-items: center; height: 48px; }
.chat-find-steps > span { min-width: 64px; padding: 0 8px; box-sizing: border-box; font-size: 14px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.chat-find .iconbtn[aria-disabled] { opacity: .35; cursor: default; }
.chat-dock .chat-find .input:focus-visible { outline: none; box-shadow: var(--ev-ring); }
.chat-thread .chat-find { position: sticky; top: var(--ev-header-height); z-index: 4; }
/* at 860 px and below the header scrolls away (app.css), so the band sticks to the top of the screen */
@media (max-width: 860px) { .chat-thread .chat-find { top: 0; } }
.chat-win .chat-find { flex: 0 0 auto; padding: 12px 16px; }
.chat-thread mark, .chat-win mark { border-radius: 4px; padding: 0 2px; background: var(--ev-primary-soft); color: var(--ev-primary-ink); }
.chat-found { outline: 2px solid var(--ev-primary-ink); outline-offset: 2px; }

/* ---------- „Mesaje” on the web: the list and the open conversation ---------- */

.chat-page { display: flex; flex-wrap: wrap; gap: 24px; align-items: stretch; }
.chat-page.staff { gap: 32px; align-items: flex-start; }
.chat-page-side { flex: 1 1 320px; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-content: start; }
.chat-page.staff > .chat-page-side { flex-basis: 300px; }
.chat-page-main { flex: 2.4 1 560px; min-width: 0; }
.chat-page.staff > .chat-page-main { flex-grow: 2.2; }
.chat-page-side.card { display: block; }
.chat-page-none { margin: 0; }
.empty.chat-page-empty { padding: 40px; gap: 12px; min-height: 0; }
.chat-page-empty .card-title { margin: 0; color: var(--ev-text); }
.empty.chat-page-empty p { max-width: 520px; }
.chat-page-empty .btn { margin-top: 8px; }
.chat-page-choose > .empty.lone { min-height: 520px; padding: 48px; }
.chat-page.list-only .chat-page-choose, .chat-page.list-only .chat-page-wide { display: none; }
@media (max-width: 640px) { .chat-page-choose, .chat-page-wide { display: none; } }
.chat-page-side > .callout { margin: 0 0 -8px; }
.chat-page-side > .chat-page-deleted { margin: -8px 0 0; }
.chat-page-card > .chat-row-shape { padding: 16px; }
.card.chat-page-card { padding: 12px; }
.chat-page-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.chat-page-row { width: 100%; display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 0; border-radius: var(--ev-radius); background: transparent; color: var(--ev-text); font: inherit; text-align: left; cursor: pointer; }
.chat-page-row:hover { color: var(--ev-text); background: var(--ev-surface-2); }
.chat-page-row.current { background: var(--ev-surface-2); }
.chat-page-what { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.chat-page-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; min-width: 0; }
.chat-page-top .caption { white-space: nowrap; }
.chat-page-text { color: var(--ev-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chat-page-badge { margin-top: 4px; }
.chat-page-search { margin-bottom: 16px; }
.row.chat-staff-row { width: 100%; flex-wrap: nowrap; justify-content: flex-start; gap: 12px; padding: 14px 16px; font: inherit; text-align: left; cursor: pointer; }
.row.chat-staff-row:hover { border-color: var(--ev-border-strong); color: var(--ev-text); }
.row.chat-staff-row.current { border-color: var(--ev-ink); background: var(--ev-surface-2); }
.row.chat-staff-row .main { flex: 1 1 0; gap: 2px; }
.chat-staff-row strong { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-staff-row .chat-page-top { align-items: center; }
.chat-staff-row .chat-page-text { color: var(--ev-muted); }
.chat-staff-row .chat-page-text.unread { color: var(--ev-text); font-weight: 600; }
.chat-members ul { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 16px; }
.chat-members li { display: flex; gap: 12px; align-items: center; }
.chat-member { display: grid; min-width: 0; overflow-wrap: anywhere; }

.card.chat-thread { padding: 0; display: flex; flex-direction: column; }
.chat-thread p { margin: 0; }
.chat-thread-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--ev-border); }
.chat-thread.staff .chat-thread-head { justify-content: space-between; padding: 16px 24px; }
.chat-thread-who { flex: 1 1 200px; min-width: 0; }
.chat-thread-head .card-title { margin: 0; }
.chat-thread-actions { display: flex; gap: 8px; align-items: center; }
.chat-options { position: relative; }
.chat-options-menu { position: absolute; z-index: 3; right: 0; top: 48px; display: grid; gap: 4px; width: 290px; max-width: calc(100vw - 64px); padding: 12px; background: var(--ev-surface); border: 1px solid var(--ev-border); border-radius: var(--ev-radius); box-shadow: var(--ev-shadow-md); }
.chat-options-menu .btn, .chat-item-menu .btn { justify-content: flex-start; min-height: 44px; padding: 0 8px; }
.btn.bad, .chat-options-menu .bad, .chat-item-menu .bad, .chat-staff-menu .bad { --btn-fg: var(--ev-danger-ink); }
.callout.chat-thread-banner { margin: 0; border-radius: 0; padding: 12px 24px; }
.chat-thread-tools { display: grid; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--ev-border); background: var(--ev-bg); }
.chat-ask { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--ev-border); border-radius: var(--ev-radius); background: var(--ev-surface); }
.chat-ask .action-error { margin-top: 0; }
.chat-ask-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-win > .chat-thread-tools { flex: 0 0 auto; padding: 12px 16px; }
.chat-ask-actions .btn { width: auto; }
.chat-thread-log { list-style: none; margin: 0; padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.chat-thread.staff .chat-thread-log { padding: 24px; }
.chat-thread-log > li:focus { outline: none; }
.chat-thread-log > li:focus-visible { box-shadow: none; outline: 2px solid var(--ev-primary-ink); outline-offset: 4px; border-radius: var(--ev-radius); }
.chat-thread-day { text-align: center; }
.chat-older { width: 100%; list-style: none; }
.chat-thread-gone { width: fit-content; padding: 10px 16px; border: 1px dashed var(--ev-border-strong); border-radius: 16px; }
.chat-gone-mine { justify-self: end; }
.chat-thread .chat-gone-other { margin-left: 52px; }
.chat-item { display: flex; gap: 12px; align-items: flex-end; max-width: 84%; }
.chat-item.mine { gap: 4px; align-items: center; justify-content: flex-end; justify-self: end; }
.chat-item-body { display: grid; gap: 4px; min-width: 0; }
.mine > .chat-item-body { justify-items: end; }
.chat-item-body .action-error { margin-top: 0; }
.chat-item-bubble { display: grid; gap: 8px; min-width: 0; padding: 12px 16px; border-radius: 16px 16px 16px 4px; background: var(--ev-surface-2); overflow-wrap: anywhere; }
.mine .chat-item-bubble { border-radius: 16px 16px 4px 16px; background: var(--ev-ink); color: var(--ev-on-ink); }
.chat-item-meta, .chat-item-status { display: inline-flex; gap: 8px; align-items: center; }
.chat-item-status { gap: 4px; color: var(--ev-muted); }
.chat-item-status.seen { color: var(--ev-success-ink); }
.chat-item-options { flex: 0 0 auto; align-self: center; }
.chat-item-options > .iconbtn { color: var(--ev-muted); }
.chat-item-menu { position: absolute; z-index: 2; right: 0; top: 44px; display: grid; width: 190px; padding: 8px; background: var(--ev-surface); border: 1px solid var(--ev-border); border-radius: var(--ev-radius); box-shadow: var(--ev-shadow-md); }
.chat-item-menu.up { top: auto; bottom: 44px; }
.mine .chat-item-menu { right: auto; left: 0; }
.chat-staff-item .chat-item-menu { right: auto; left: 0; top: 48px; width: 200px; }
.chat-staff-item .chat-item-menu.up { top: auto; bottom: 48px; }
.chat-staff-item .chat-item-menu .btn { width: 100%; }
.chat-thread .chat-file { width: 100%; padding: 10px 14px; gap: 12px; }
.chat-staff-item { display: flex; gap: 12px; align-items: flex-end; max-width: 82%; }
.chat-staff-item.mine { display: grid; justify-items: end; gap: 4px; justify-self: end; }
.chat-staff-body { min-width: 0; }
.chat-staff-from { margin-bottom: 4px; }
.chat-staff-time { margin-top: 4px; }
.chat-staff-line { display: flex; gap: 4px; align-items: center; min-width: 0; }
.chat-staff-bubble { min-width: 0; padding: 12px 16px; border-radius: var(--ev-radius); background: var(--ev-surface-2); overflow-wrap: anywhere; }
.chat-staff-text { display: block; white-space: pre-line; }
.mine .chat-staff-bubble { background: var(--ev-ink); color: var(--ev-on-ink); }
.chat-staff-meta { display: inline-flex; gap: 6px; align-items: center; }
.chat-staff-menu { list-style: none; margin: 0; padding: 8px; width: 240px; border: 1px solid var(--ev-border); border-radius: var(--ev-radius); background: var(--ev-surface); box-shadow: var(--ev-shadow-md); }
.chat-staff-menu .btn { width: 100%; min-height: 44px; justify-content: flex-start; font-size: 14px; }
.chat-editor { display: grid; gap: 8px; width: min(420px, 100%); min-width: min(280px, 60vw); }
.chat-editor textarea { min-height: 72px; }
.chat-editor-actions { display: flex; gap: 8px; }
.chat-editor-actions .btn { flex: 1 1 0; width: auto; min-height: 44px; padding: 0 12px; }
.chat-thread .chat-editor { box-sizing: border-box; width: 380px; max-width: 100%; min-width: 0; gap: 12px; padding: 16px; border: 1px solid var(--ev-border-strong); border-radius: 16px; background: var(--ev-surface); }
.chat-thread .chat-editor-actions { justify-content: flex-end; }
.chat-thread .chat-editor-actions .btn { flex: 0 0 auto; min-height: 40px; padding: 0 16px; }
.chat-thread .caption.chat-thread-typing { padding: 0 20px 12px; }
.chat-thread.staff .caption.chat-thread-typing { padding: 0 24px 16px; }
.chat-thread-form { display: grid; gap: 12px; padding: 16px 20px 20px; border-top: 1px solid var(--ev-border); margin-top: auto; }
.chat-thread-form textarea { min-height: 80px; }
.chat-thread.staff .chat-thread-form { gap: 16px; padding: 16px 24px; }
.chat-thread.staff .chat-thread-form textarea { min-height: 88px; }
.chat-thread-form .action-error { margin-top: 0; }
.chat-thread-send { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.chat-thread-send > .caption { flex: 1 1 160px; }
.chat-thread-closed { display: grid; gap: 16px; padding: 20px; border-top: 1px solid var(--ev-border); margin-top: auto; }
.chat-thread-closed .callout { margin: 0; }

/* ---------- The phone app: the list, the conversation, its details ---------- */

.row.chat-phone-row { width: 100%; flex-wrap: nowrap; justify-content: flex-start; gap: 12px; padding: 16px; align-items: flex-start; font: inherit; text-align: left; cursor: pointer; }
.row.chat-phone-row .main { flex: 1 1 0; }
.chat-phone-row .chat-page-top { align-items: baseline; }
.chat-phone-subject { color: var(--ev-text-2); }
.chat-phone-text { color: var(--ev-muted); overflow-wrap: anywhere; }
.chat-phone-text.unread { color: var(--ev-text); font-weight: 600; }
.chat-phone-list { display: grid; gap: 20px; }
.phone-main .chat-phone-list > .page-head, .phone-main .chat-info > .page-head { margin: 0; }
.chat-phone-list .callout { margin: 0; }
.chat-phone-search { position: relative; margin: 0; }
.chat-phone-search .input { padding-left: 44px; }
.chat-phone-search > svg { position: absolute; left: 14px; top: 14px; color: var(--ev-muted); pointer-events: none; }
.chat-phone-list.lawyer .empty-icon { display: block; color: var(--ev-primary-ink); } /* PhoneLawyerMessagesEmpty: the mark in its line, in the primary ink */
.chat-phone-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--ev-primary-ink); font-weight: 600; text-decoration: underline; }
.chat-phone-hints ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.chat-phone-hints h2 { margin: 0; }

.chat-phone { display: flex; flex-direction: column; min-height: 100%; }
.chat-phone-head { display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 16px; background: var(--ev-surface); border-bottom: 1px solid var(--ev-border); }
.phone-main .chat-phone-head h1 { margin: 0; font-size: 16px; line-height: 1.4; font-weight: 700; letter-spacing: 0; overflow-wrap: anywhere; }
.chat-phone-who { flex: 1 1 0; min-width: 0; }
.chat-phone-tools { display: flex; flex: 0 0 auto; }
.callout.chat-phone-banner { margin: 0; border-radius: 0; padding: 12px 16px; justify-content: center; font-weight: 600; }
.chat-phone-log { flex: 1 0 auto; list-style: none; margin: 0; padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: end; }
.chat-phone-log > li:focus { outline: none; }
.chat-phone-log .caption { margin: 0; }
.chat-phone-day { text-align: center; font-weight: 600; }
.chat-phone-log .chat-new { font-weight: 600; }
.chat-phone-item { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.chat-phone-item .avatar { width: 32px; height: 32px; border-radius: 10px; font-size: 13px; }
.chat-phone-item.mine { justify-self: end; max-width: 86%; display: grid; gap: 4px; justify-items: end; }
.chat-phone-body { min-width: 0; display: grid; gap: 4px; }
.chat-phone-bubble { display: grid; gap: 10px; min-width: 0; padding: 12px 14px; border: 1px solid var(--ev-border); border-radius: var(--ev-radius) var(--ev-radius) var(--ev-radius) 4px; background: var(--ev-surface); color: var(--ev-text); font: inherit; text-align: left; overflow-wrap: anywhere; }
.chat-phone-bubble p { margin: 0; }
/* A long press opens the menu of the message; it selects no word of it as well. */
.chat-phone-bubble { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.mine .chat-phone-bubble { border-color: transparent; border-radius: var(--ev-radius) var(--ev-radius) 4px var(--ev-radius); background: var(--ev-ink); color: var(--ev-on-ink); }
.chat-phone-bubble.picked { outline: 2px solid var(--ev-primary); outline-offset: 2px; }
.chat-phone-time { display: flex; gap: 6px; align-items: center; font-size: 13px; line-height: 1.45; color: var(--ev-muted); }
.mine .chat-phone-time { justify-content: flex-end; color: var(--ev-border); }
.chat-phone-bubble .chat-file { width: 100%; border: 0; background: var(--ev-surface-2); }
.chat-phone-bubble .chat-file > span > span { color: var(--ev-text-2); }
.mine .chat-phone-bubble .chat-file { border: 1px solid var(--ev-muted); background: transparent; color: var(--ev-on-ink); }
.mine .chat-phone-bubble .chat-file > span > span { color: var(--ev-border); }
.chat-phone-gone { justify-self: start; margin: 0 0 0 40px; padding: 10px 14px; border: 1px dashed var(--ev-border-strong); border-radius: var(--ev-radius); color: var(--ev-muted); }
.chat-gone-mine .chat-phone-gone { margin-left: 0; }
.chat-phone-item .action-error, .chat-phone-item + .action-error { margin: 0; }
.chat-phone .chat-phone-typing { margin: 0 0 0 56px; padding-bottom: 12px; }
.chat-phone .chat-phone-typing.flush { margin-left: 16px; } /* PhoneAccountantChat: under the messages, at the screen's edge */
.chat-phone-foot { position: relative; z-index: 20; }
.chat-phone-form { display: grid; gap: 8px; padding: 10px 8px 12px; background: var(--ev-surface); border-top: 1px solid var(--ev-border); }
.chat-phone-file { display: flex; gap: 8px; align-items: center; margin: 0 8px; padding: 4px 4px 4px 12px; border: 1px solid var(--ev-border); border-radius: var(--ev-radius); }
.chat-phone-file > .small { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.chat-phone-write { display: flex; gap: 4px; align-items: flex-end; }
.chat-phone-write > .iconbtn { width: 48px; height: 48px; flex: 0 0 auto; }
.chat-phone-write textarea { flex: 1 1 0; min-width: 0; min-height: 48px; max-height: 120px; padding: 11px 14px; resize: none; display: block; field-sizing: content; }
.chat-phone-write .btn { width: 48px; padding: 0; flex: 0 0 auto; }
/* A press on it while it is locked is a press on the bar, which leaves the focus in the field. */
.chat-phone-write .btn:disabled { pointer-events: none; }
.chat-phone-errors { display: grid; gap: 8px; margin: 0 8px; }
.chat-phone-errors .action-error { margin: 0; }
.chat-phone-closed { display: grid; gap: 12px; padding: 16px; background: var(--ev-surface); border-top: 1px solid var(--ev-border); }
.chat-phone-closed .callout { margin: 0; }
.chat-phone-closed .btn, .chat-phone-sheet .btn { width: 100%; }
.chat-phone-sheet { padding: 12px 0 16px; background: var(--ev-surface); border-top: 1px solid var(--ev-border); border-radius: var(--ev-radius-lg) var(--ev-radius-lg) 0 0; box-shadow: var(--ev-shadow-md); }
.chat-phone-sheet > .caption { margin: 0; padding: 4px 16px 8px; }
.chat-phone-sheet ul { margin: 0; padding: 0; list-style: none; }
.chat-phone-sheet li button { width: 100%; min-height: 52px; display: flex; gap: 12px; align-items: center; padding: 0 16px; border: 0; background: transparent; font: 600 16px/1.3 var(--ev-font); color: var(--ev-text); text-align: left; cursor: pointer; }
.chat-phone-sheet li button.bad { color: var(--ev-danger-ink); }
.chat-phone-sheet-cancel { padding: 8px 16px 0; }
.chat-phone-lone { padding: 16px; }
.phone-main .chat-phone-shape { flex-wrap: nowrap; }
.row.chat-phone-shape > .chat-row-shape { flex: 1 1 0; padding: 0; }
.chat-phone-shape .skel.tile { width: 44px; height: 44px; }
.row.chat-phone-shape:nth-child(2) .skel:not(.tile) { width: 44%; }
.row.chat-phone-shape:nth-child(2) .skel.thin { width: 32%; }
.chat-phone-list > p { margin: -12px 0 0; }
.chat-info { display: grid; gap: 20px; }
.chat-info .section-title { margin-bottom: 12px; }
.chat-info-find { display: flex; gap: 8px; align-items: flex-end; }
.chat-info-find .field { flex: 1 1 0; }
.chat-info-find .btn { width: auto; padding: 0 16px; }
.row.chat-info-row { width: 100%; flex-wrap: nowrap; justify-content: flex-start; gap: 12px; padding: 12px 16px; font: inherit; text-align: left; }
.row.chat-info-row .main { flex: 1 1 0; }
.chat-info-ask { display: grid; gap: 12px; padding: 16px; border-radius: var(--ev-radius); background: var(--ev-danger-soft); }
.chat-info-ask p { margin: 0; }
.chat-info-ask > div:not(.action-error) { display: flex; gap: 8px; }
.chat-info-ask > div > .btn { flex: 1 1 0; width: auto; padding: 0 12px; }

/* The conversation fills the screen it is given, edge to edge: its head and its composer stand still, its messages scroll between them. */
.chat-phone { display: flex; flex-direction: column; min-height: 0; }
.chat-phone > :not(.chat-view) { flex: none; }
.chat-phone .chat-scroll { overscroll-behavior: contain; overflow-anchor: none; }

/* ---------- The client's home: the latest messages ---------- */

.home-messages { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 20px; }
.home-messages + .btn { margin-top: 20px; }
.home-message { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; color: var(--ev-text); }
.home-message:hover { color: var(--ev-text); }
.home-message-body { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.home-message-top { display: flex; justify-content: space-between; gap: 8px; }
.home-message-top .caption { white-space: nowrap; }
.home-message-text { color: var(--ev-text-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.home-message-badge { margin-top: 4px; }

/* A notification's toast stands above the launcher, not over it. */
@media (min-width: 641px) { body:has(main.has-chat) .notif-toasts { bottom: 104px; } }

/* ==== BATCH 6 (start): pictures in a conversation, the picked files, the paperclip's choices, the dossier card's head. ==== */
/* a message with pictures: the pictures' card, then the bubble with the text and the documents; never a dark frame around a picture */
.chat-parts { display: grid; gap: 4px; justify-items: start; min-width: 0; max-width: 100%; }
.mine .chat-parts, .chat-parts.own { justify-items: end; }
.chat-photo { display: block; width: 240px; max-width: 100%; min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--ev-border-strong); border-radius: 16px 16px 16px 4px; background: var(--ev-surface); color: var(--ev-text); font: 400 14px/1.4 var(--ev-font); text-align: left; }
.chat-photo.own { border-radius: 16px 16px 4px 16px; }
.chat-photo.on-page { width: 320px; }
.chat-photo.phone-w { width: 264px; }
button.chat-photo, .chat-photo button { cursor: pointer; }
.chat-photo-cell { display: block; width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
.chat-photo-view { position: relative; display: grid; place-items: center; width: 100%; padding: 0; border: 0; border-bottom: 1px solid var(--ev-border); background: var(--ev-surface-2); overflow: hidden; }
.chat-photo-view > svg.pic-art { display: block; width: 100%; height: 100%; }
.chat-photo-view .skel { width: 100%; height: 100%; border-radius: 0; }
.chat-photo-part { position: absolute; right: 8px; bottom: 8px; display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border: 1px solid var(--ev-border-strong); border-radius: var(--ev-pill); background: var(--ev-surface); color: var(--ev-text); font-size: 13px; line-height: 1.45; font-weight: 600; }
.chat-photo-foot { display: grid; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
.chat-name { display: flex; min-width: 0; font-weight: 600; }
.chat-name > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-name > span + span { flex: 0 0 auto; }
.chat-photo-meta { display: flex; gap: 8px; justify-content: space-between; align-items: center; font-size: 13px; line-height: 1.45; color: var(--ev-muted); }
.chat-photo-time { display: inline-flex; gap: 6px; align-items: center; }
/* several pictures in one message */
.chat-photo.many { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--ev-border); }
.chat-photo.many > button { background: var(--ev-surface); }
.chat-photo.many > .chat-photo-cell.wide { grid-column: 1 / -1; }
.chat-photo-more, .chat-photo-all { grid-column: 1 / -1; min-height: 44px; display: flex; gap: 8px; align-items: center; padding: 0 12px; border: 0; background: transparent; color: var(--ev-text); font: 600 14px/1.4 var(--ev-font); }
.chat-photo-more { justify-content: center; }
.chat-photo-all { justify-content: flex-end; font-size: 13px; font-weight: 400; color: var(--ev-muted); }
.chat-photo-note { display: grid; gap: 8px; justify-items: center; padding: 12px; font-size: 14px; line-height: 1.4; text-align: center; color: var(--ev-text-2); }
.chat-photo-note .btn-sm { width: auto; height: 44px; }
.chat-photo-again { display: grid; place-items: center; width: 100%; min-height: 96px; border-bottom: 1px solid var(--ev-border); background: var(--ev-surface-2); }
/* a picture that cannot be shown: the document's row, on its own */
.chat-file.lone { width: 240px; border-color: var(--ev-border-strong); border-radius: 16px 16px 16px 4px; }
.chat-file.lone.own { border-radius: 16px 16px 4px 16px; }
.chat-file.lone.on-page { width: 320px; }
.chat-file.lone.phone-w { width: 264px; }
/* the document's row in an own bubble: the same on the web and on the phone */
.chat-file.on-ink { border-color: var(--ev-muted); background: transparent; color: var(--ev-on-ink); }
.chat-file.on-ink > span > span { color: inherit; opacity: .82; }
/* the files picked for the next message */
.chat-picks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 0 0 8px; padding: 0; list-style: none; }
.chat-picks.many { max-height: 164px; overflow-y: auto; }
.chat-picks.two { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: 0; }
.chat-picks-count { margin: 0 0 8px; font-size: 13px; line-height: 1.45; color: var(--ev-muted); }
.chat-pick { position: relative; display: flex; gap: 10px; align-items: center; min-height: 62px; padding: 8px 4px 8px 8px; border: 1px solid var(--ev-border-strong); border-radius: var(--ev-radius); background: var(--ev-surface); overflow: hidden; font-size: 14px; line-height: 1.4; }
.chat-pick-thumb { position: relative; flex: 0 0 44px; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--ev-border-strong); border-radius: var(--ev-radius-sm); background: var(--ev-surface-2); overflow: hidden; }
.chat-pick-thumb > svg.pic-art { display: block; width: 100%; height: 100%; }
.chat-pick-thumb .skel { width: 100%; height: 100%; border-radius: 0; }
.chat-pick-main { flex: 1 1 0; min-width: 0; display: grid; }
.chat-pick-main > span + span { font-size: 13px; line-height: 1.45; color: var(--ev-muted); }
.chat-pick-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--ev-surface-3); }
.chat-pick-bar > i { display: block; width: 45%; height: 100%; background: var(--ev-ink); }
@media (prefers-reduced-motion: no-preference) { .chat-pick-bar > i { animation: pick-bar 1.4s ease-in-out infinite; } @keyframes pick-bar { from { transform: translateX(-100%); } to { transform: translateX(223%); } } }
/* a sentence beside the locked „Trimite”: not an error, the message is still here */
.chat-wait { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0 0; padding: 12px 14px; border-radius: var(--ev-radius); background: var(--ev-warning-soft); color: var(--ev-warning-ink); font-size: 14px; line-height: 1.4; font-weight: 600; }
.chat-send[aria-disabled="true"], .btn-primary[aria-disabled="true"] { opacity: .5; }
/* what the paperclip of the phone app offers, above the bar; the keyboard stays */
.chat-choose { display: grid; gap: 8px; }
.chat-choose-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chat-choose-row > button { min-height: 72px; display: grid; gap: 4px; justify-items: center; align-content: center; padding: 8px 4px; border: 1px solid var(--ev-border-strong); border-radius: var(--ev-radius); background: var(--ev-surface); color: var(--ev-text); font: 600 14px/1.4 var(--ev-font); cursor: pointer; }
.chat-choose-row > button[aria-disabled="true"] { opacity: .5; }
/* the dossier's card on the phone: the status on its own line, the name and its line under it on the whole width */
/* a page emptied of the former person: nothing but the ground, the logo and the box on one axis */
.dlg.lone { width: min(440px, 100%); display: grid; justify-items: center; text-align: center; border: 1px solid var(--ev-border); }
.dlg.lone > span:first-child { margin-bottom: 24px; }
.dlg.lone h3 { text-wrap: balance; }
.lone-actions { width: 100%; display: grid; gap: 12px; margin-top: 24px; }
.lone-actions .btn { width: 100%; }
.lone-line { display: grid; gap: 24px; justify-items: center; text-align: center; font-weight: 600; }
/* ==== BATCH 6 (end) ==== */

/* ==== BATCH 7 (start): many picked files, many refusals, the short notices, older messages. ==== */
/* the composer never leaves its place: the files and the refusals scroll in their own room */
.chat-picks-head { display: flex; gap: 12px; justify-content: space-between; margin: 0 0 8px; font-size: 13px; line-height: 1.45; color: var(--ev-muted); }
.chat-picks-head strong { font-weight: 600; color: var(--ev-text-2); }
.chat-picks.many.tight { max-height: 92px; }
.chat-picks.two.many { max-height: 172px; }
.chat-picks.two { align-content: start; }
/* little room: one line for all the files */
.chat-pick-sum { width: 100%; min-height: 48px; display: flex; gap: 10px; align-items: center; padding: 4px 12px 4px 8px; border: 1px solid var(--ev-border-strong); border-radius: var(--ev-radius); background: var(--ev-surface); color: var(--ev-text); font: 600 14px/1.4 var(--ev-font); text-align: left; cursor: pointer; }
.chat-pick-sum > span:nth-child(2) { flex: 1 1 0; min-width: 0; }
.chat-pick-stack { flex: 0 0 auto; display: flex; }
.chat-pick-stack > .chat-pick-thumb { flex: 0 0 32px; width: 32px; height: 32px; }
.chat-pick-stack > .chat-pick-thumb + .chat-pick-thumb { margin-left: -12px; }
/* files that were not added: one line for each reason */
.chat-refused { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; align-items: start; max-height: 120px; overflow-y: auto; margin: 8px 0 0; padding: 12px 14px; border-radius: var(--ev-radius); background: var(--ev-danger-soft); color: var(--ev-danger-ink); font-size: 14px; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }
.chat-refused.phone-w { max-height: 88px; }
.chat-refused > div { display: grid; gap: 8px; justify-items: start; }
.chat-refused ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.chat-refused .names { font-weight: 400; }
.chat-refused .chat-names-btn { min-height: 44px; margin: -8px 0; padding: 0; border: 0; background: transparent; color: inherit; font: 600 14px/1.4 var(--ev-font); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
/* older messages being read: always the same room, so nothing moves */
.chat-older { min-height: 32px; display: grid; place-items: center; font-size: 13px; line-height: 1.45; color: var(--ev-muted); text-align: center; }
/* ==== BATCH 7 (end) ==== */

/* ==== BATCH 7, corrections (start): a pill stays a pill on a selected row and under the pointer. ==== */
a[aria-current] .badge, .current .badge, .row:hover .badge, .chat-row:hover .badge, .is-hover .badge { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 24%, transparent); }
a[aria-current] .badge:not(.ok, .warn, .bad, .hot), .current .badge:not(.ok, .warn, .bad, .hot), .row:hover .badge:not(.ok, .warn, .bad, .hot), .chat-row:hover .badge:not(.ok, .warn, .bad, .hot), .is-hover .badge:not(.ok, .warn, .bad, .hot) { background: var(--ev-surface); }
/* in the dark theme a grey pill has the line everywhere: its ground is too close to the card's */
@media (prefers-color-scheme: dark) { .badge:not(.ok, .warn, .bad, .hot) { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 24%, transparent); } }
/* ==== BATCH 7, corrections (end) ==== */

/* ==== BATCH 8 (start): the way to the newest message; the company menu that could not be read; the document that is being sent. ==== */
/* the messages and what floats over them; nothing floats over the header, the write row, the files or a notice */
.chat-view { position: relative; flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.chat-jump { position: absolute; z-index: 3; left: 0; right: 0; bottom: 12px; margin-inline: auto; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border: 1px solid var(--ev-border-strong); border-radius: var(--ev-pill); background: var(--ev-surface); color: var(--ev-text); box-shadow: var(--ev-shadow-md); cursor: pointer; }
.chat-jump:focus-visible { outline: 2px solid var(--ev-ink); outline-offset: 2px; }
.chat-jump > .chat-count { top: -13px; right: auto; left: 50%; transform: translateX(-50%); border-color: var(--ev-surface); }
.chat-view.low > .chat-jump { bottom: 2px; }
/* on a page the messages are the page: the button keeps to the end of what is seen of the conversation */
.chat-jump.on-page { position: sticky; bottom: 16px; justify-self: center; margin: -60px auto 16px; }
@media (prefers-reduced-motion: no-preference) { .chat-jump { animation: jump-in .12s ease-out; } @keyframes jump-in { from { opacity: 0; transform: scale(.9); } } }
/* dark theme: the other way round, so that it stands out on the dark page; the line parts it from one's own (light) bubbles */
@media (prefers-color-scheme: dark) { .chat-jump { background: var(--ev-ink); color: var(--ev-on-ink); } }
@media (prefers-color-scheme: dark) { .chat-jump > .chat-count { background: var(--ev-on-ink); color: var(--ev-ink); border-color: var(--ev-ink); } }

/* ---------- Batches 6 to 8 in the app: what the boards draw with a picture of their own, and where the app's parts differ ---------- */

/* The picture itself, in the place its card keeps for it. */
.chat-photo-view > img { display: block; max-width: none; margin-inline: auto; }
.chat-photo-view > .skel { position: absolute; inset: 0; }
.chat-photo { box-sizing: border-box; }
button.chat-photo:focus-visible, .chat-photo button:focus-visible { outline: 2px solid var(--ev-ink); outline-offset: 2px; }
.chat-photo-more, .chat-photo-all { cursor: pointer; }
.chat-files-more { min-height: 44px; border: 1px solid var(--ev-border-strong); border-radius: var(--ev-radius-sm); background: transparent; color: inherit; cursor: pointer; }
.mine .chat-files-more, .chat-parts.own .chat-files-more { border-color: var(--ev-muted); }
.chat-parts.chat-found { border-radius: 16px; }
.chat-parts.picked { outline: 2px solid var(--ev-primary); outline-offset: 2px; border-radius: var(--ev-radius); }
.chat-parts > .chat-phone-bubble.picked { outline: 0; }
.chat-item-bubble .chat-file, .chat-staff-bubble .chat-file { width: 280px; max-width: 100%; }
.chat-staff-text ~ .chat-file, .chat-staff-text ~ .chat-files-more { margin-top: 8px; }
.chat-phone-bubble .chat-file.on-ink { border: 1px solid var(--ev-muted); }
.chat-pick-thumb > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.chat-pick-thumb { color: var(--ev-text-2); }
.chat-pick > .iconbtn { flex: 0 0 44px; }
.chat-copied { min-height: 44px; display: flex; gap: 10px; align-items: center; margin: 0; padding: 0 10px; font-size: 14px; font-weight: 600; color: var(--ev-success-ink); }
.chat-phone-sheet .chat-copied { min-height: 52px; padding: 0 16px; font-size: 16px; }
.chat-phone-sheet li > .action-error { margin: 0 16px 8px; }
.chat-phone-sheet li > button:not(.btn) { width: 100%; min-height: 52px; display: flex; gap: 12px; align-items: center; padding: 0 16px; border: 0; background: transparent; font: 600 16px/1.3 var(--ev-font); color: var(--ev-text); text-align: left; cursor: pointer; }
.chat-menu .chat-copied { padding: 0 10px; }
.chat-refused > svg { margin-top: 1px; }
.chat-wait > svg, .chat-wait > .chat-icon { flex: 0 0 auto; }
.chat-older .load-error { margin: 0; text-align: left; }
.chat-older > span { padding: 4px 0; }

/* The composer never leaves its window: the files and the refusals give way, the row one writes in and 48 px of messages stay. */
.chat-win > .chat-view { flex: 1 1 0; min-height: 48px; }
.chat-win > .chat-note { min-height: 48px; }
.chat-form { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
.chat-form > .chat-write { flex: 0 0 auto; }
.chat-form > .chat-picked, .chat-phone-picks > .chat-picked { min-height: 0; display: flex; flex-direction: column; }
.chat-form > .chat-picked { flex: 0 1 auto; }
.chat-picked > .chat-picks { min-height: 0; overscroll-behavior: contain; }
.chat-picked > .chat-pick-sum { display: none; margin: 0 0 8px; }
.chat-form > .chat-refused { flex: 0 1 auto; min-height: 48px; overscroll-behavior: contain; }
.chat-win { container: chat-win / size; }
@container chat-win (max-height: 439px) { .chat-picks.many { max-height: 92px; } }
@container chat-win (max-height: 359px) {
    .chat-picked.summed > .chat-pick-sum { display: flex; }
    .chat-picked.summed > .chat-picks-head, .chat-picked.summed:not(.open) > .chat-picks { display: none; }
    .chat-picked.summed.open > .chat-picks.many { max-height: none; }
}
.chat-thread-form .chat-picked > .chat-picks { margin: 0; }
@media (max-width: 640px) { .chat-picks.two { grid-template-columns: minmax(0, 1fr); } .chat-picks.two.many { max-height: 164px; } }

/* The way to the newest message: over the messages, centred on their column. */
.chat-view > .chat-scroll { flex: 1 1 0; min-height: 0; }
.chat-view { container: chat-view / size; }
@container chat-view (max-height: 95px) { .chat-jump { bottom: 2px; } }
.chat-thread-view { display: grid; grid-template-columns: minmax(0, 1fr); }

/* The phone: the files and the paperclip's row stand in the bar, the messages keep 48 px, a low screen has one line for the files. */
.chat-phone > .chat-view { flex: 1 1 0; min-height: 48px; }
.chat-phone-form { min-height: 0; }
.chat-phone-picks { margin: 0 8px; min-width: 0; }
.chat-phone-picks .chat-picks { margin: 0; }
.chat-phone-picks .chat-picks-head { margin: 0 0 8px; }
.chat-choose { margin: 0 8px; }
.chat-choose .action-error { margin: 0; }
.chat-attach.open { background: var(--ev-surface-2); }
.chat-phone-write > button[aria-disabled="true"], .chat-phone-write > .btn[aria-disabled="true"] { opacity: .5; }
.chat-phone-back { display: none; flex: 0 0 auto; }
.chat-phone { container: chat-phone / size; }
@container chat-phone (max-height: 423px) {
    .chat-phone-picks .chat-picked.summed > .chat-pick-sum { display: flex; }
    .chat-phone-picks .chat-picked.summed > .chat-picks-head, .chat-phone-picks .chat-picked.summed:not(.open) > .chat-picks { display: none; }
    .chat-phone-picks .chat-picks.many { max-height: 92px; }
}
@container chat-phone (max-height: 303px) {
    .chat-phone-back { display: inline-grid; }
    .chat-phone-head { padding: 4px 8px 4px 4px; }
    .chat-phone-head .avatar, .chat-phone-head .caption { display: none; }
}
@container chat-phone (max-height: 183px) { .chat-phone-head { display: none; } }
html[data-keyboard] .chat-phone .chat-names-btn { display: none; }
