/* message actions: hover bar, menus, edit, select, pins, forward */

.msg[data-mid] { transition: background .1s; }
.msg.is-menu, .msg.is-open { background: rgba(0, 0, 0, .12); }
:root[data-theme="light"] .msg.is-menu, :root[data-theme="light"] .msg.is-open { background: var(--panel-2); }
.msg.is-editing { background: var(--accent-soft); }
.msg.is-sel, .msg.is-sel:hover { background: var(--accent-soft); }
.msg.ca-flash { animation: ca-flash 1.4s; }
@keyframes ca-flash { 0%, 40% { background: rgba(227, 179, 65, .2); } }
.msg.ca-press { animation: ca-press .45s; }
@keyframes ca-press { 60% { background: var(--panel-3); transform: scale(.985); } }

.ca-pinned { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--warn); flex: none; }
.ca-pinned svg { width: 12px; height: 12px; }

.ca-hover {
  position: absolute; right: 18px; top: -16px; z-index: 3; display: none; align-items: center; gap: 1px; padding: 3px;
  border-radius: var(--r); background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .5);
}
.msg:hover > .ca-hover, .msg.is-menu > .ca-hover { display: flex; }
.ca-selecting .ca-hover, .msg.is-editing > .ca-hover { display: none !important; }
.ca-hover .icon-btn { width: 30px; height: 30px; border-radius: var(--r-sm); }
.ca-hover .icon-btn svg { width: 18px; height: 18px; }
.ca-hover .icon-btn.is-danger:hover { color: var(--bad); background: rgba(229, 83, 75, .14); }
.ca-hover__q { width: 30px; height: 30px; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; font-size: 16px; line-height: 1; transition: transform .1s, background .1s; }
.ca-hover__q:hover { background: var(--panel-3); transform: scale(1.12); }
.ca-hover__sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 3px; }

.ca-check {
  display: none; position: absolute; left: 6px; top: 10px; width: 18px; height: 18px; border-radius: 5px;
  border: 2px solid var(--line-3); background: var(--panel); place-items: center;
}
.ca-selecting .msg[data-mid] { padding-left: 34px; cursor: pointer; user-select: none; }
.ca-selecting .msg[data-mid] .ca-check { display: grid; }
.msg.is-sel .ca-check { background: var(--accent); border-color: var(--accent); }
.msg.is-sel .ca-check::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }

.ca-react { cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; height: 26px; transition: transform .1s, border-color .1s; }
.ca-react:hover:not(:disabled) { border-color: var(--line-3); }
.ca-react.is-me:hover { border-color: var(--accent); }
.ca-react:active:not(:disabled) { transform: scale(.92); }
.ca-react:disabled { cursor: default; }
.ca-react.ca-bump { animation: ca-bump .3s; }
@keyframes ca-bump { 50% { transform: scale(1.18); } }
.ca-remoji { display: inline-flex; align-items: center; font-size: 15px; line-height: 1; }
.ca-remoji img { width: 18px; height: 18px; object-fit: contain; }
.ca-react--add { opacity: 0; width: 30px; padding: 0; justify-content: center; color: var(--ink-3); }
.ca-react--add svg { width: 15px; height: 15px; }
.msg:hover .ca-react--add, .ca-react--add:focus-visible { opacity: 1; }
@media (hover: none) { .ca-react--add { opacity: 1; } }

.ca-edit { margin-top: 4px; }
.ca-edit__ta {
  display: block; width: 100%; min-height: 42px; max-height: 260px; resize: none; border-radius: var(--r); border: 1px solid var(--accent);
  background: var(--panel); padding: 10px 12px; outline: none; color: var(--ink); line-height: 1.45; font: inherit;
  box-shadow: 0 0 0 3px var(--accent-soft); unicode-bidi: plaintext;
}
.ca-edit small { display: block; font-size: 11.5px; color: var(--ink-4); margin-top: 4px; }
.ca-edit__a { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.ca-edit__a:hover { text-decoration: underline; }

.msg__reply { cursor: pointer; }
.msg__reply:hover span { color: var(--ink); }
.ca-selecting .msg__reply { pointer-events: none; }

.ca-mention { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 3px; font-weight: 500; }
.ca-mention.is-user { cursor: pointer; }
.ca-mention.is-user:hover { text-decoration: underline; }

.ca-fwd { border-left: 3px solid var(--line-3); padding: 2px 0 2px 10px; margin: 4px 0 2px; min-width: 0; }
.ca-fwd small { display: flex; align-items: center; gap: 5px; color: var(--ink-4); font-size: 11.5px; }
.ca-fwd small svg { width: 13px; height: 13px; flex: none; }

/* header tools */
.ca-tools { display: flex; align-items: center; gap: 2px; flex: none; margin-left: auto; }
.main__title .auto-delete + .ca-tools { margin-left: 8px; }
.ca-tool.is-active { color: var(--accent); background: var(--accent-soft); }
.ca-pincount {
  position: absolute; top: 2px; right: 1px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; line-height: 1;
}

/* composer: reply bar and select bar */
.ca-rbar {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; margin-bottom: -2px; font-size: 12.5px; color: var(--ink-3);
  border-radius: var(--r-md) var(--r-md) 0 0; background: var(--panel-3); animation: ca-rise .16s;
}
.ca-rbar > svg { width: 15px; height: 15px; color: var(--ink-4); flex: none; }
.ca-rbar__t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-rbar__t b { color: var(--ink); font-weight: 600; }
.ca-rbar__at { border: 0; background: none; font: inherit; font-weight: 700; color: var(--accent); cursor: pointer; padding: 4px 6px; border-radius: var(--r-xs); }
.ca-rbar__at:hover { background: var(--accent-soft); }
.ca-rbar__at.is-off { color: var(--ink-4); }
.ca-rbar .ca-rbar__x { width: 26px; height: 26px; }
.ca-rbar .ca-rbar__x svg { width: 15px; height: 15px; }
.ca-rbar:not([hidden]) + .composer__box { border-top-left-radius: 0; border-top-right-radius: 0; }
.composer.is-selecting > :not(.ca-selbar):not(.composer__typing) { display: none !important; }
.ca-selbar {
  display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 8px 8px 14px; border-radius: var(--r-md);
  background: var(--panel-2); box-shadow: 0 0 0 1px var(--accent); animation: ca-rise .18s;
}
.ca-selbar[hidden] { display: none; }
.ca-selbar > b { flex: 1; min-width: 0; font-size: 13px; }
.ca-selbar small { color: var(--ink-4); font-weight: 400; margin-left: 6px; }
.ca-selbar .btn svg { width: 16px; height: 16px; }
.btn.ca-link { background: none; color: var(--ink-3); box-shadow: none; }
.btn.ca-link:hover { background: none; color: var(--ink); text-decoration: underline; box-shadow: none; }
@keyframes ca-rise { from { opacity: 0; transform: translateY(6px); } }

/* menu */
.ca-menu.pop { min-width: 230px; }
.ca-qrow { display: flex; gap: 2px; padding: 2px 2px 6px; }
.ca-qrow button { flex: 1; height: 36px; border: 0; border-radius: var(--r-sm); background: var(--panel-2); cursor: pointer; font-size: 18px; transition: transform .1s, background .1s; }
.ca-qrow button:hover { background: var(--panel-3); transform: scale(1.08); }
.sheet.ca-menu { padding-left: 12px; padding-right: 12px; }
.ca-sq { display: flex; gap: 6px; margin-bottom: 12px; }
.ca-sq button { flex: 1; height: 46px; border: 0; border-radius: 14px; background: var(--panel-2); font-size: 22px; cursor: pointer; color: var(--ink-3); display: grid; place-items: center; }
.ca-sq button svg { width: 22px; height: 22px; }
.ca-grp { border-radius: 14px; background: var(--panel-2); overflow: hidden; margin-bottom: 10px; }
.ca-srow { display: flex; align-items: center; gap: 12px; width: 100%; height: 48px; padding: 0 14px; border: 0; border-bottom: 1px solid var(--line); background: none; font-size: 15px; color: var(--ink); text-align: left; cursor: pointer; }
.ca-srow:last-child { border-bottom: 0; }
.ca-srow svg { width: 20px; height: 20px; color: var(--ink-3); }
.ca-srow:active { background: var(--panel-3); }
.ca-srow.is-danger, .ca-srow.is-danger svg { color: var(--bad); }
@media (hover: none) {
  .msg[data-mid] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}

.ca-emoji-pop.pop { width: 320px; }
.ca-emoji { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.ca-emoji button { height: 36px; border: 0; border-radius: var(--r-sm); background: none; font-size: 20px; cursor: pointer; }
.ca-emoji button:hover { background: var(--panel-3); }

/* pins */
.ca-pins {
  position: fixed; z-index: 65; width: 380px; max-width: calc(100vw - 16px); max-height: min(70dvh, 560px); display: flex; flex-direction: column;
  border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: pop .14s;
}
.ca-pins header { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.ca-pins header > svg { width: 18px; height: 18px; color: var(--ink-3); }
.ca-sp { flex: 1; }
.ca-pins__list { overflow-y: auto; padding: 8px; overscroll-behavior: contain; }
.ca-pin { position: relative; padding: 10px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--panel-2); margin-bottom: 8px; }
.ca-pin:last-child { margin-bottom: 0; }
.ca-pin__meta { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.ca-pin__meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-pin__meta time { color: var(--ink-4); font-size: 11.5px; flex: none; }
.ca-pin .msg__body { font-size: 13px; margin-top: 4px; max-height: 120px; overflow: hidden; }
.ca-pin__acts { position: absolute; right: 8px; top: 8px; display: none; gap: 4px; }
.ca-pin:hover .ca-pin__acts, .ca-pin:focus-within .ca-pin__acts { display: flex; }
.ca-pin__acts button { height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2); font-size: 12px; cursor: pointer; }
.ca-pin__acts button:hover { border-color: var(--accent); color: var(--accent); }
@media (hover: none) { .ca-pin__acts { position: static; display: flex; margin-top: 8px; } }
.ca-empty { padding: 26px 16px; text-align: center; color: var(--ink-4); font-size: 13px; }
@media (max-width: 820px) {
  .ca-pins { left: 8px; right: 8px; width: auto; top: calc(60px + var(--top, 0px)); }
}

/* modals */
.ca-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(4, 5, 8, .62); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.ca-modal { width: 440px; max-width: 100%; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; border-radius: 16px; background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: pop .16s; overflow: hidden; }
.ca-modal__bd { padding: 20px 20px 4px; overflow-y: auto; min-height: 0; }
.ca-modal h2 { font-size: 18px; margin: 0 0 6px; }
.ca-modal p { margin: 0 0 14px; color: var(--ink-3); font-size: 13.5px; }
.ca-modal__ft { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; background: var(--panel-2); margin-top: 14px; flex: none; }
.ca-quote { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--panel-2); margin-bottom: 12px; }
.ca-quote b { font-size: 13px; }
.ca-quote__t { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 110px; overflow: hidden; }
.ca-tip { font-size: 12px; color: var(--ink-4); }
.ca-tip kbd { font: 600 11px var(--font); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-3); }
.ca-inp { display: block; width: 100%; height: 40px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--panel-2); padding: 0 12px; outline: none; color: var(--ink); font: inherit; }
.ca-inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ca-modal--fwd .ca-inp:first-of-type { margin-bottom: 8px; }
.ca-modal--fwd .ca-tlist + .ca-inp { margin-top: 10px; }
.ca-tlist { max-height: 240px; overflow-y: auto; margin: 0 -6px; overscroll-behavior: contain; }
.ca-trow { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 6px 8px; border: 0; border-radius: var(--r); background: none; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.ca-trow:hover:not(:disabled) { background: var(--panel-2); }
.ca-trow:disabled { opacity: .4; cursor: default; }
.ca-trow__ic { width: 26px; height: 26px; flex: none; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--panel-3); color: var(--ink-3); }
.ca-trow__ic svg { width: 15px; height: 15px; }
.ca-trow__t { flex: 1; min-width: 0; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-trow__t small { display: block; color: var(--ink-4); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.ca-tick { width: 20px; height: 20px; flex: none; border-radius: 6px; border: 2px solid var(--line-3); display: grid; place-items: center; color: transparent; }
.ca-tick svg { width: 14px; height: 14px; stroke-width: 3; }
.ca-trow.is-on .ca-tick { background: var(--accent); border-color: var(--accent); color: #fff; }
.ca-err { display: block; color: var(--bad); font-size: 12.5px; margin-top: 8px; }
.ca-err[hidden] { display: none; }
@media (max-width: 820px) {
  .ca-scrim { place-items: end center; padding: 0; }
  .ca-modal { width: 100%; max-height: 90dvh; border-radius: 22px 22px 0 0; animation: sheet-up .25s cubic-bezier(.2, .9, .3, 1); }
  .ca-modal__ft { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .ca-modal__ft .btn { min-height: 44px; }
}
