/* Neotopia staff chat: General and Proof. Uses app.css tokens. */

.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--panel); min-height: 60px; flex-wrap: wrap; }
.chat-tabs { display: flex; gap: 4px; padding: 3px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.chat-tab { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px; border-radius: 9px; color: var(--text-2); font-weight: 650; font-size: 13.5px; text-decoration: none; }
.chat-tab:hover { color: var(--text); text-decoration: none; }
.chat-tab.on { background: var(--panel-3); color: var(--text); box-shadow: var(--shadow-sm); }
.chat-tab.on .icon { color: var(--accent-hi); }
.chat-tab .badge { height: 18px; min-width: 18px; font-size: 10.5px; }
.chat-search { width: 240px; }
.show-sm { display: none; }
.spinner.xs { width: 12px; height: 12px; border-width: 2px; }
.linkish { border: 0; background: none; padding: 0; color: var(--accent-hi); font: inherit; font-weight: 650; cursor: pointer; }
.linkish:hover { text-decoration: underline; }

/* drop anywhere */
.chat-veil { position: absolute; inset: 8px; z-index: 5; display: none; place-items: center; border: 2px dashed var(--accent); border-radius: 16px; background: rgba(10, 12, 20, .72); color: #fff; pointer-events: none; }
:root[data-theme="light"] .chat-veil { background: rgba(246, 247, 251, .85); color: var(--text); }
.chat-veil > div { display: grid; justify-items: center; gap: 10px; }
.chat-veil .icon { width: 30px; height: 30px; color: var(--accent-hi); }
.chat-veil b { font-size: 15px; }
.chat.dropping .chat-veil { display: grid; }

/* ---------- General ---------- */
.chat-room { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-scroll-wrap { flex: 1; min-height: 0; position: relative; }
.chat-scroll { position: absolute; inset: 0; overflow-y: auto; padding: 8px 24px 16px; overscroll-behavior: contain; }
.chat-inner { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; }
.chat-loading { display: grid; place-items: center; padding: 60px 0; }
.chat-more { display: flex; justify-content: center; padding: 14px 0 4px; min-height: 44px; }
.chat-empty { display: grid; justify-items: center; gap: 6px; padding: 72px 20px; color: var(--text-3); text-align: center; }
.chat-empty .icon { width: 30px; height: 30px; }
.chat-empty b { color: var(--text); font-size: 15px; }
.chat .day-sep { align-self: stretch; display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; }
.chat .day-sep::before, .chat .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.cgroup { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 8px 0 2px; }
.cgroup .avatar { width: 36px; height: 36px; margin-top: 2px; }
.cg-meta { display: flex; align-items: baseline; gap: 8px; min-height: 20px; }
.cg-meta b { font-size: 14px; }
.cg-meta time { font-size: 11.5px; color: var(--text-3); }
.cg-rows { display: grid; }
.crow { position: relative; padding: 2px 40px 2px 0; margin: 0 -8px 0 -56px; padding-left: 56px; border-radius: 8px; }
.crow:hover { background: var(--hover); }
.crow-time { position: absolute; left: 0; width: 48px; top: 5px; text-align: right; font-size: 10.5px; color: var(--text-3); opacity: 0; font-variant-numeric: tabular-nums; }
.crow:hover .crow-time { opacity: 1; }
.ctext { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: 14.5px; }
.ctext .edited { font-size: 11px; color: var(--text-3); }
.ctext code { font: 12.5px var(--mono); background: var(--panel-3); padding: 1px 5px; border-radius: 5px; }
.ctext pre { font: 12.5px var(--mono); background: var(--panel-3); padding: 9px 11px; border-radius: 8px; margin: 4px 0; overflow-x: auto; white-space: pre; }
.crow-act { position: absolute; right: 6px; top: 2px; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); color: var(--text-2); cursor: pointer; opacity: 0; box-shadow: var(--shadow-sm); }
.crow:hover .crow-act, .crow-act:focus-visible { opacity: 1; }
.crow-act:hover { color: var(--text); }
@media (hover: none) { .crow-act { opacity: .55; border-color: transparent; background: transparent; box-shadow: none; } }

/* files inside a message */
.cmedia { margin: 6px 0 4px; }
.cmedia.single { display: flex; }
.cmedia.grid { display: grid; gap: 4px; max-width: 460px; border-radius: 12px; overflow: hidden; }
.cmedia.grid.n2 { grid-template-columns: repeat(2, 1fr); }
.cmedia.grid.n3 { grid-template-columns: repeat(3, 1fr); }
.cmedia.grid.n4 { grid-template-columns: repeat(4, 1fr); max-width: 520px; }
.cm { position: relative; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--panel-3); color: var(--text-3); cursor: zoom-in; max-width: 100%; }
.cmedia.grid .cm { aspect-ratio: 1; border-radius: 0; }
.cm img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cmedia.single .cm img { object-fit: contain; background: #000; }
.cm:hover img { filter: brightness(1.06); }
.cm.wait { cursor: default; display: grid; gap: 6px; place-content: center; justify-items: center; font-size: 12px; min-height: 90px; }
.cm.wait.bad { color: var(--red); }
.cm .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; backdrop-filter: blur(4px); }
.cm .play .icon { margin-left: 2px; }
.cm .dur { position: absolute; right: 6px; bottom: 6px; font-size: 11px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .6); padding: 1px 6px; border-radius: 6px; }
.cmedia.grid .cm .play { width: 32px; height: 32px; }

/* messages still sending */
.cgroup.sending .cg-body { opacity: .78; }
.cgroup.sending.failed .cg-body { opacity: 1; }
.c-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); }
.c-status.bad { color: var(--red); gap: 10px; }

/* editing */
.c-editbox { display: grid; gap: 4px; margin: 2px 0; }
.c-edit { width: 100%; resize: none; border: 1px solid var(--accent-line); background: var(--panel-2); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14.5px; line-height: 1.5; outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.c-edithint { font-size: 11.5px; color: var(--text-3); }

.chat-jump { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 650; font-size: 12.5px; cursor: pointer; box-shadow: var(--shadow); }
.chat-jump[hidden] { display: none; }

/* composer */
.chat-compose-wrap { padding: 0 24px 18px; }
.chat-composer { max-width: 880px; }
.c-row { display: flex; align-items: flex-end; gap: 6px; padding: 6px 6px 6px 6px; }
.chat-composer textarea { flex: 1; width: auto; min-width: 0; padding: 9px 4px; min-height: 40px; max-height: 200px; font-size: 14.5px; }
.c-attach { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; color: var(--text-2); cursor: pointer; }
.c-attach:hover { background: var(--hover); color: var(--text); }
.c-send { width: 38px; height: 38px; flex: none; border-radius: 10px; }
.c-tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 10px 2px; }
.c-tray[hidden] { display: none; }
.c-tray.in-message { padding: 6px 0 2px; }
.c-item { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: var(--panel-3); border: 1px solid var(--line-2); flex: none; }
.c-tray.big .c-item, .c-tray.big .c-add { width: 104px; height: 104px; }
.c-item img, .c-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.c-file { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-3); }
.c-kind { position: absolute; left: 5px; top: 5px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; }
.c-prog { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 4px; background: rgba(0, 0, 0, .45); overflow: hidden; transition: opacity .3s .3s; }
.c-prog i { display: block; height: 100%; width: 0; background: var(--accent-hi); transition: width .2s; }
.c-item.done .c-prog { opacity: 0; }
.c-retry { display: none; position: absolute; inset: 0; border: 0; background: rgba(60, 12, 12, .72); color: #fff; font: 700 12px var(--font); cursor: pointer; }
.c-item.failed .c-retry { display: block; }
.c-item.failed .c-prog { display: none; }
.c-item .rm { position: absolute; right: 4px; top: 4px; z-index: 1; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; display: grid; place-items: center; cursor: pointer; }
.c-add { width: 76px; height: 76px; flex: none; border-radius: 10px; border: 1.5px dashed var(--line-2); display: grid; place-items: center; color: var(--text-3); cursor: pointer; }
.c-add:hover { border-color: var(--accent-line); color: var(--text); background: var(--accent-soft); }

/* ---------- Proof ---------- */
.proof-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px 40px; }
.proof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.proof-grid > .chat-loading, .proof-grid > .chat-empty, .proof-grid > .proof-empty { grid-column: 1 / -1; }
.proof-more { display: flex; justify-content: center; padding: 20px 0 0; }
.proof-card { display: grid; grid-template-rows: auto 1fr; padding: 0; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; color: inherit; font: inherit; cursor: pointer; transition: border-color .12s, transform .12s; }
.proof-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.proof-card.pending { cursor: default; }
.proof-card.pending:hover { transform: none; }
.proof-card.failed { border-color: var(--red); }
.proof-cover { position: relative; aspect-ratio: 16 / 10; background: var(--panel-3); overflow: hidden; }
.proof-cover img, .proof-cover video { width: 100%; height: 100%; object-fit: cover; display: block; }
.proof-card.pending .proof-cover img, .proof-card.pending .proof-cover video { opacity: .6; }
.proof-nopic { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.proof-cover .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; }
.proof-cover .play .icon { margin-left: 2px; }
.proof-count { position: absolute; right: 8px; bottom: 8px; font-size: 11.5px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .62); padding: 2px 8px; border-radius: 999px; }
.proof-info { display: grid; align-content: start; gap: 6px; padding: 12px 14px 14px; min-width: 0; }
.proof-title { font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proof-desc { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proof-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); margin-top: 2px; min-width: 0; }
.proof-meta .who { color: var(--text-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof-meta .when::before { content: "·"; margin-right: 6px; }
.proof-empty { display: grid; justify-items: center; gap: 8px; padding: 64px 20px; border: 1.5px dashed var(--line-2); border-radius: 16px; background: transparent; color: var(--text-3); font: inherit; cursor: pointer; }
.proof-empty:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text-2); }
.proof-empty .icon { width: 30px; height: 30px; color: var(--accent-hi); }
.proof-empty b { color: var(--text); font-size: 15px; }

.proof-drop { display: grid; }
.proof-pick { display: grid; justify-items: center; gap: 6px; padding: 34px 16px; border: 1.5px dashed var(--line-2); border-radius: 14px; color: var(--text-3); cursor: pointer; text-align: center; transition: border-color .12s, background .12s; }
.proof-pick:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text-2); }
.proof-pick .icon { width: 26px; height: 26px; color: var(--accent-hi); }
.proof-pick b { color: var(--text); font-size: 14.5px; }
.proof-drop .c-tray { padding: 0; }

.proof-detail { display: grid; gap: 14px; }
.proof-by { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.proof-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 14.5px; }
.proof-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.proof-files .cm { aspect-ratio: 4 / 3; border-radius: 10px; }
.proof-foot { flex: 1; }

@media (max-width: 860px) {
  .chat-head { padding: 10px 12px; gap: 8px; min-height: 0; }
  .chat-tab { padding: 0 12px; }
  .chat-search { order: 3; width: 100%; }
  .chat .hide-sm { display: none; }
  .chat .show-sm { display: inline; }
  .chat-scroll { padding: 6px 12px 12px; }
  .crow { margin-left: -50px; padding-left: 50px; padding-right: 30px; }
  .crow-act { right: 0; }
  .chat-compose-wrap { padding: 0 10px 10px; }
  .proof-scroll { padding: 14px 12px 32px; }
  .proof-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .proof-info { padding: 10px 11px 12px; }
  .proof-desc { display: none; }
  .c-tray.big .c-item, .c-tray.big .c-add { width: 84px; height: 84px; }
}
