/* Discuss (messaging), record chatter, receipt strip, lightbox. Tokens from admin.css only; logical properties for RTL. */

/* ------------------------------------------------------------ top bar button */
.chat-btn { position: relative; }
.chat-badge { position: absolute; inset-block-start: 2px; inset-inline-end: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800; line-height: 17px; text-align: center; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--bg); }
:root[data-theme="dark"] .chat-badge { color: #1a0b0a; }
.chat-btn.has-unread { color: var(--accent-d); }

/* ------------------------------------------------------------ shared atoms */
.dsc-av { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; box-shadow: inset 0 0 0 40px rgba(0, 0, 0, .38); color: #fff; font-weight: 800; font-size: 13px; flex: 0 0 auto; user-select: none; }
.dsc-av-sm { width: 28px; height: 28px; font-size: 11px; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn.btn-sm .ico { display: inline-flex; }
.dsc-hash { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); flex: 0 0 auto; }
.dsc-hash.inbox { background: var(--info-soft); color: var(--info-ink); }
.dsc-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-solid); color: #fff; font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .dsc-badge { color: #06201d; }

/* ------------------------------------------------------------ app layout */
.dsc-page { max-width: 1280px; }
.dsc-app { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100dvh - 124px); min-height: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.dsc-side { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--line); background: var(--panel-2); }
.dsc-side-head { display: flex; align-items: center; gap: 8px; padding-block: 14px 6px; padding-inline: 16px 8px; }
.dsc-side-head h1 { font-size: 18px; }
.dsc-search { margin: 4px 14px 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); outline: 0; min-width: 0; }
.dsc-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.dsc-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.dsc-section { display: flex; align-items: center; justify-content: space-between; padding-block: 12px 2px; padding-inline: 10px 2px; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dsc-section .icon-btn { width: 30px; height: 30px; }
.dsc-none { padding: 4px 10px; }
.dsc-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: start; min-height: 52px; }
.dsc-item:hover { background: var(--panel-3); }
.dsc-item.active { background: var(--brand-soft); }
.dsc-item-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.dsc-item-title { display: flex; align-items: center; gap: 6px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsc-item.unread .dsc-item-title { font-weight: 800; }
.dsc-item-sub { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsc-item.unread .dsc-item-sub { color: var(--ink); }
.dsc-item-end { display: grid; justify-items: end; gap: 4px; flex: 0 0 auto; }
.dsc-item-end small { font-size: 11px; }
.dsc-muted-ico { color: var(--muted); display: inline-flex; }

/* ------------------------------------------------------------ conversation */
.dsc-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); }
.dsc-pane > .empty { margin: auto; }
.dsc-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); min-height: 60px; }
.dsc-head-title { flex: 1; min-width: 0; display: grid; }
.dsc-head-title h3 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsc-head-title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsc-back { display: none; }
.dsc-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 8px; display: flex; flex-direction: column; gap: 2px; outline: 0; overscroll-behavior: contain; }
.dsc-older { align-self: center; margin-block-end: 8px; }
.dsc-hello { margin: auto; }
.dsc-day { display: flex; align-items: center; gap: 12px; margin: 14px 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.dsc-day::before, .dsc-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.dsc-newpill { position: absolute; inset-inline-start: 50%; transform: translateX(-50%); inset-block-end: 84px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; box-shadow: var(--shadow); z-index: 3; }
:root[dir="rtl"] .dsc-newpill { transform: translateX(50%); }
:root[data-theme="dark"] .dsc-newpill { color: #06201d; }

/* messages */
.dsc-msg { position: relative; display: flex; gap: 10px; padding: 5px 8px; margin-inline: -8px; border-radius: var(--r-sm); }
.dsc-msg:hover { background: var(--panel-2); }
.dsc-msg.grouped { padding-block: 1px; }
.dsc-gutter { width: 36px; flex: 0 0 auto; display: grid; place-items: center; }
.dsc-hover-time { opacity: 0; font-size: 10.5px; }
.dsc-msg:hover .dsc-hover-time { opacity: 1; }
.dsc-main { flex: 1; min-width: 0; }
.dsc-head-row, .dsc-msg .dsc-head { display: flex; align-items: baseline; gap: 8px; padding: 0; border: 0; min-height: 0; }
.dsc-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.dsc-text a { color: var(--accent-d); text-decoration: underline; }
.dsc-mention { padding: 0 4px; border-radius: 5px; background: var(--info-soft); color: var(--info-ink); font-weight: 700; }
.dsc-mention.me { background: var(--warn-soft); color: var(--warn-ink); }
.dsc-edited { color: var(--muted); font-size: 11px; margin-inline-start: 6px; }
.dsc-actions { position: absolute; inset-block-start: -6px; inset-inline-end: 8px; display: none; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); box-shadow: var(--shadow); }
.dsc-actions .icon-btn { width: 30px; height: 30px; }
.dsc-msg:hover .dsc-actions, .dsc-msg:focus-within .dsc-actions, .dsc-msg.tap .dsc-actions { display: flex; }
.dsc-msg.deleted .dsc-body { font-size: 13px; }
.dsc-edit { width: 100%; padding: 8px 10px; border: 1px solid var(--accent); border-radius: var(--r-sm); background: var(--panel); outline: 0; resize: vertical; }
.dsc-edit-foot { display: flex; justify-content: flex-end; gap: 6px; margin-block-start: 6px; }

/* attachments in messages */
.dsc-atts { display: grid; gap: 6px; margin-block-start: 4px; }
.dsc-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.dsc-thumb { padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--panel-3); width: 128px; height: 128px; cursor: zoom-in; display: block; }
.dsc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dsc-thumb:hover { border-color: var(--accent); }
.dsc-files { display: flex; flex-wrap: wrap; gap: 6px; }
.dsc-file { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 10px; min-height: 36px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-2); color: var(--ink); }
.dsc-file:hover { border-color: var(--accent); }
.dsc-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dsc-file small { color: var(--muted); flex: 0 0 auto; }

/* composer */
.dsc-composer { position: relative; padding: 8px 12px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.dsc-row { display: flex; align-items: flex-end; gap: 4px; }
.dsc-input { flex: 1; min-width: 0; resize: none; max-height: 150px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); outline: 0; line-height: 1.4; }
.dsc-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.dsc-row .icon-btn { flex: 0 0 auto; height: 40px; width: 40px; color: var(--muted); }
.dsc-row .icon-btn:hover { color: var(--ink); }
.dsc-send { height: 40px; flex: 0 0 auto; padding: 0 12px; }
@media (pointer: fine) { .dsc-cam { display: none; } }
.dsc-pending { display: flex; flex-wrap: wrap; gap: 6px; margin-block-end: 8px; }
.dsc-pchip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding-block: 3px; padding-inline: 8px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); font-size: 12.5px; font-weight: 600; }
.dsc-pchip img { width: 24px; height: 24px; object-fit: cover; border-radius: 50%; }
.dsc-pchip.err { border-color: var(--danger); color: var(--danger-ink); }
.dsc-pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsc-mentions { position: absolute; inset-inline: 12px; inset-block-end: calc(100% - 4px); z-index: 5; display: grid; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; }
.dsc-mi { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; text-align: start; min-height: 40px; }
.dsc-mi.sel, .dsc-mi:hover { background: var(--brand-soft); }
.dsc-mi-name { font-weight: 650; }
.dsc-mi small { color: var(--muted); margin-inline-start: auto; }

/* inbox + dialogs */
.dsc-inbox { display: grid; gap: 2px; }
.dsc-inbox-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: start; min-height: 56px; }
.dsc-inbox-item:hover { background: var(--panel-2); }
.dsc-inbox-item.unread { background: var(--info-soft); }
.dsc-inbox-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.dsc-picks { display: grid; gap: 2px; max-height: 300px; overflow-y: auto; }
.dsc-pick { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: start; min-height: 44px; cursor: pointer; }
.dsc-pick:hover { background: var(--panel-2); }
.dsc-pick input { width: 18px; height: 18px; accent-color: var(--accent); }
.dsc-pick small { margin-inline-start: auto; }
.dsc-members { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 2px; }
.dsc-members li { display: flex; align-items: center; gap: 10px; padding: 4px 4px; min-height: 40px; }

/* ------------------------------------------------------------ lightbox */
.dsc-lightbox { position: fixed; inset: 0; z-index: 400; display: flex; flex-direction: column; background: color-mix(in srgb, var(--side) 94%, transparent); color: var(--side-ink); }
.dsc-lb-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
.dsc-lb-cap { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.dsc-lb-bar .icon-btn { color: var(--side-ink); }
.dsc-lb-bar .icon-btn:hover:not(:disabled) { background: var(--side-2); }
.dsc-lb-stage { position: relative; flex: 1; min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; padding: 8px 52px 16px; overflow: hidden; }
.dsc-lb-stage img { max-width: 100%; max-height: calc(100dvh - 96px); object-fit: contain; border-radius: var(--r-sm); }
.dsc-lb-nav { position: absolute; inset-block-start: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--side-2); color: var(--side-ink); display: grid; place-items: center; }
.dsc-lb-nav.prev { inset-inline-start: 6px; }
.dsc-lb-nav.next { inset-inline-end: 6px; }

/* ------------------------------------------------------------ record chatter */
.ch { display: grid; gap: 12px; align-content: start; margin-block-start: 6px; }
.ch-drawer { box-shadow: none; padding: 14px; }
.ch-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.ch-head h3 { font-size: 15px; padding-block: 8px; }
.ch-tabs { display: flex; gap: 4px; }
.ch-tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; min-height: 40px; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; background: transparent; font-weight: 700; color: var(--muted); }
.ch-tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.ch-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--panel-3); color: var(--muted); font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ch-tab.on .ch-count { background: var(--brand-soft); color: var(--brand); }
.ch-follow { display: inline-flex; align-items: center; gap: 6px; padding-block-end: 4px; }
.ch-follow .btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-d); }
.ch-fcount { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 8px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-weight: 700; }
.ch-fcount:hover { background: var(--panel-3); }
.ch-panel { display: grid; gap: 12px; }
.ch-list { display: grid; gap: 2px; }
.ch-list .dsc-msg { margin-inline: 0; padding-inline: 4px; }
.ch-list .dsc-msg:hover { background: transparent; }
.ch-list .dsc-msg + .dsc-msg { border-top: 1px solid var(--line-2); border-radius: 0; }
.ch-older { justify-self: center; margin-block-start: 8px; }
.ch-empty { text-align: center; padding: 14px 8px; }
.ch-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.ch-att { display: grid; gap: 4px; width: 128px; }
.ch-att.file { width: auto; max-width: 100%; display: flex; align-items: center; gap: 4px; }
.ch-att-meta { display: flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); }
.ch-att-meta span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-rm { width: 30px; height: 30px; flex: 0 0 auto; }
.ch-followers { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ch-followers li { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.ch .dsc-composer { padding: 0; border: 0; }
.ch .dsc-mentions { inset-inline: 0; }
.ch-host { margin-block-start: 6px; }
.ch-drawer .dsc-row { flex-wrap: wrap; }
.ch-drawer .dsc-input { order: -1; flex: 1 1 100%; }
.ch-drawer .dsc-send { margin-inline-start: auto; }

/* ------------------------------------------------------------ receipt photos strip */
.ch-strip { display: grid; gap: 10px; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent-soft) 40%, var(--panel)); }
.ch-strip-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ch-strip-head h3 { font-size: 15px; }
.ch-strip-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.ch-strip-item { position: relative; }
.ch-strip-item .dsc-thumb { width: 96px; height: 96px; }
.ch-strip-x { position: absolute; inset-block-start: 4px; inset-inline-end: 4px; display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--side) 78%, transparent); color: var(--side-ink); }
.ch-strip-x:hover { background: var(--danger); color: #fff; }
.ch-strip-empty { font-size: 13.5px; }

/* ------------------------------------------------------------ purchase from photo dialog */
.pfp-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-block-end: 12px; }
.pfp-shot { position: relative; width: 92px; height: 92px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--panel-3); }
.pfp-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pfp-shot button { position: absolute; inset-block-start: 4px; inset-inline-end: 4px; display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--side) 78%, transparent); color: var(--side-ink); }
.pfp-add { display: grid; place-items: center; gap: 4px; align-content: center; width: 92px; height: 92px; border: 2px dashed var(--line); border-radius: var(--r-sm); background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; padding: 4px; }
.pfp-add:hover { border-color: var(--accent); color: var(--accent-d); }
.pfp-big { display: flex; flex-wrap: wrap; gap: 8px; margin-block-end: 14px; }
.pfp-big .btn { flex: 1 1 160px; min-height: 52px; font-size: 15px; }
.pur-cam { color: var(--accent-d); display: inline-flex; vertical-align: middle; margin-inline-start: 6px; }

/* ------------------------------------------------------------ phone: list <-> conversation */
@media (max-width: 720px) {
  .dsc-app { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 162px); border-radius: var(--r-sm); margin-inline: -4px; }
  .dsc-app:not(.has-conv) .dsc-pane { display: none; }
  .dsc-app.has-conv .dsc-side { display: none; }
  .dsc-side { border-inline-end: 0; }
  .dsc-back { display: inline-grid; }
  .dsc-scroll { padding-inline: 12px; }
  .dsc-thumb { width: 104px; height: 104px; }
  .dsc-item { min-height: 58px; }
  .dsc-lb-stage { padding-inline: 8px; }
  .dsc-newpill { inset-block-end: 76px; }
  .ch-tab { padding-inline: 10px; }
  .ch .btn-sm, .ch-strip .btn-sm, .dsc-head .btn-sm { min-height: 40px; }
  .ch .dsc-row { flex-wrap: wrap; }
  .ch .dsc-input { order: -1; flex: 1 1 100%; }
  .ch .dsc-send { margin-inline-start: auto; }
  .ch-strip-item .dsc-thumb { width: 84px; height: 84px; }
}
