/* MitaBase Pro — a product of ETMITA · https://etmita.com
   Copyright © ETMITA. All rights reserved. */
/* ════════════════════════════════════════════════════════════════
   NACHRICHTEN v3 — the office↔driver line.

   The page is src/features/chat/chat.page.ts →
   public/js/pages/chat.js; this sheet holds every .ch3-* rule.
   Token-native under .mt-scope — dark mode is a token swap, never a
   parallel rule set. The driver PWA's .chat-* rules live in its own
   sheet and are unrelated. Two panes; on the phone one at a time
   (.has-room slides the list away).
   ════════════════════════════════════════════════════════════════ */

.ch3-wrap { display: flex; flex: 1; min-height: 0; }
.ch3-ic { flex: 0 0 auto; }
.ch3-av { flex: 0 0 auto; }
.ch3-avfall { display: inline-grid; place-items: center; border-radius: 999px; background: var(--surface-inset); color: var(--text-secondary); font-size: .68rem; font-weight: 800; flex: 0 0 auto; }

/* ── thread list ────────────────────────────────────────────────── */
.ch3-list { display: flex; flex-direction: column; width: 320px; flex: 0 0 320px; min-height: 0; overflow-y: auto; border-inline-end: 1px solid var(--border-subtle); background: var(--surface-card); }
.ch3-list-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px; background: var(--surface-card); border-block-end: 1px solid var(--border-subtle); }
.ch3-search { display: flex; align-items: center; gap: 7px; flex: 1; padding: 0 10px; height: 38px; border-radius: 10px; border: 1px solid var(--border-subtle); background: var(--surface-inset); color: var(--text-muted); }
.ch3-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--text-primary); font: inherit; font-size: .8rem; }
.ch3-search input:focus { outline: none; }
.ch3-search:focus-within { outline: 2px solid var(--accent-fill-solid); outline-offset: 1px; }
.ch3-new { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--accent-fill-solid); color: var(--accent-contrast); cursor: pointer; flex: 0 0 auto; }
.ch3-new:hover { filter: brightness(1.06); }
.ch3-new:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: 2px; }

.ch3-picker { display: flex; flex-direction: column; padding: 8px; gap: 2px; border-block-end: 1px solid var(--border-subtle); background: var(--surface-inset); }
.ch3-picker-h { margin: 2px 4px 6px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.ch3-pick { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 4px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--text-primary); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; text-align: start; }
.ch3-pick span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch3-pick .ch3-ic:last-child { color: var(--text-muted); }
.ch3-pick:hover { background: var(--surface-hover); }
.ch3-pick:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: -2px; }
.ch3-empty-line { margin: 8px; font-size: .76rem; color: var(--text-muted); }

.ch3-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 64px; padding: 9px 12px; border: 0; border-block-end: 1px solid var(--border-subtle); background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.ch3-row:hover { background: var(--surface-hover); }
.ch3-row.is-on { background: var(--accent-soft); }
.ch3-row.is-unread .ch3-row-top b { font-weight: 800; }
.ch3-row:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: -2px; }
.ch3-row-ic { flex: 0 0 auto; }
.ch3-row-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.ch3-row-top { display: flex; align-items: baseline; gap: 8px; }
.ch3-row-top b { flex: 1; font-size: .84rem; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch3-row-top time { font-size: .66rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ch3-row-sub { display: inline-flex; align-items: center; gap: 4px; font-size: .68rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch3-row-prev { font-size: .74rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch3-row-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-fill-solid); color: var(--accent-contrast); font-size: .66rem; font-weight: 800; flex: 0 0 auto; }

/* ── the room ───────────────────────────────────────────────────── */
.ch3-room { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; background: var(--surface-page); }
.ch3-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-block-end: 1px solid var(--border-subtle); background: var(--surface-card); }
.ch3-back { display: none; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--surface-inset); color: var(--text-secondary); cursor: pointer; }
.ch3-head-av { flex: 0 0 auto; display: inline-flex; }
.ch3-head-id { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.ch3-head-id b { font-size: .9rem; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch3-head-id span { font-size: .7rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch3-live { display: inline-flex; color: var(--text-muted); }
.ch3-live.is-on { color: var(--status-valid); }
.ch3-head-del { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--text-muted); cursor: pointer; }
.ch3-head-del:hover { background: var(--status-expired-soft); color: var(--status-expired); }

.ch3-scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; }
.ch3-day { display: flex; justify-content: center; margin: 10px 0; }
.ch3-day span { padding: 3px 12px; border-radius: 999px; background: var(--surface-inset); color: var(--text-muted); font-size: .68rem; font-weight: 700; }
.ch3-msg { display: flex; flex-direction: column; align-items: flex-start; margin-block-start: 10px; max-width: min(72%, 560px); }
.ch3-msg.is-grouped { margin-block-start: 2px; }
.ch3-msg.is-mine { align-items: flex-end; margin-inline-start: auto; }
.ch3-who { display: inline-flex; align-items: center; gap: 6px; margin-block-end: 3px; font-size: .68rem; font-weight: 700; color: var(--text-muted); }
.ch3-face { display: inline-flex; }
.ch3-bubble { position: relative; display: inline-flex; flex-direction: column; gap: 6px; padding: 9px 12px; border-radius: 14px; background: var(--surface-card); border: 1px solid var(--border-subtle); color: var(--text-primary); font-size: .84rem; line-height: 1.45; }
.ch3-msg.is-mine .ch3-bubble { background: var(--accent-soft); border-color: transparent; }
.ch3-msg.is-gone .ch3-bubble { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; color: var(--text-muted); font-style: italic; font-size: .76rem; }
.ch3-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ch3-meta { font-size: .64rem; color: var(--text-muted); align-self: flex-end; font-variant-numeric: tabular-nums; }
.ch3-imgbtn { padding: 0; border: 0; background: transparent; cursor: zoom-in; border-radius: 10px; overflow: hidden; }
.ch3-img { display: block; max-width: 260px; max-height: 240px; border-radius: 10px; }
.ch3-acts { position: absolute; inset-block-start: -12px; inset-inline-end: 6px; display: none; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-card); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-sm); }
.ch3-msg:hover .ch3-acts, .ch3-bubble:focus-within .ch3-acts { display: inline-flex; }
.ch3-acts button { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.ch3-acts button:hover { background: var(--surface-hover); color: var(--text-primary); }

.ch3-jump { position: sticky; inset-block-end: 6px; inset-inline-start: 100%; transform: translateX(-100%); display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--border-subtle); border-radius: 999px; background: var(--surface-card); color: var(--text-secondary); cursor: pointer; box-shadow: var(--shadow-sm); }
.ch3-jump:hover { color: var(--text-primary); }
.ch3-jump.hidden { display: none !important; }

/* ── composer ───────────────────────────────────────────────────── */
.ch3-composer { display: flex; flex-direction: column; gap: 7px; padding: 10px 14px 12px; border-block-start: 1px solid var(--border-subtle); background: var(--surface-card); }
.ch3-canned { display: flex; gap: 6px; flex-wrap: wrap; }
.ch3-canned button { min-height: 30px; padding: 0 11px; border: 1px solid var(--border-subtle); border-radius: 999px; background: var(--surface-inset); color: var(--text-secondary); font: inherit; font-size: .72rem; font-weight: 600; cursor: pointer; }
.ch3-canned button:hover { background: var(--surface-hover); color: var(--text-primary); }
.ch3-emoji { display: flex; gap: 2px; flex-wrap: wrap; }
.ch3-emoji button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; font-size: 1rem; cursor: pointer; }
.ch3-emoji button:hover { background: var(--surface-hover); }
.ch3-input-row { display: flex; align-items: flex-end; gap: 8px; }
.ch3-attach, .ch3-send { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px; cursor: pointer; flex: 0 0 auto; }
.ch3-attach { background: var(--surface-inset); color: var(--text-secondary); }
.ch3-attach:hover { background: var(--surface-hover); color: var(--text-primary); }
.ch3-send { background: var(--accent-fill-solid); color: var(--accent-contrast); }
.ch3-send:hover:not(:disabled) { filter: brightness(1.06); }
.ch3-send:disabled { opacity: .5; cursor: default; }
.ch3-composer textarea { flex: 1; min-width: 0; min-height: 42px; max-height: 160px; padding: 10px 12px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--surface-inset); color: var(--text-primary); font: inherit; font-size: .84rem; resize: none; }
.ch3-composer textarea:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: 1px; }
.ch3-pending { display: flex; align-items: center; gap: 8px; }
.ch3-pending img { max-height: 72px; border-radius: 10px; border: 1px solid var(--border-subtle); }
.ch3-pending button { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: var(--surface-inset); color: var(--text-secondary); cursor: pointer; }
.ch3-pending.hidden { display: none !important; }

/* ── empty / blank states ───────────────────────────────────────── */
.ch3-blank { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; flex: 1; padding: 30px; text-align: center; color: var(--text-muted); }
.ch3-blank b { font-size: .92rem; color: var(--text-primary); }
.ch3-blank p { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: .78rem; max-width: 52ch; line-height: 1.55; }
.ch3-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 16px; text-align: center; color: var(--text-muted); }
.ch3-empty b { font-size: .86rem; color: var(--text-primary); }
.ch3-empty p { margin: 0; font-size: .74rem; max-width: 34ch; line-height: 1.55; }
.ch3-empty.hidden { display: none !important; }

/* ── phone: one pane at a time ──────────────────────────────────── */
@media (max-width: 860px) {
  .ch3-list { width: 100%; flex: 1; border-inline-end: 0; }
  .ch3-wrap .ch3-room { display: none; }
  .ch3-wrap.has-room .ch3-room { display: flex; flex: 1; }
  .ch3-wrap.has-room .ch3-list { display: none; }
  .ch3-back { display: inline-grid; }
  .ch3-msg { max-width: 86%; }
  .ch3-acts { display: inline-flex; position: static; margin-block-start: 2px; box-shadow: none; border: 0; background: transparent; }
  .ch3-row, .ch3-canned button { min-height: 44px; }
}

/* ── calm by default ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ch3-wrap * { transition: none !important; animation: none !important; }
  .ch3-scroll { scroll-behavior: auto !important; }
}
