/* Direction
   Product   one inbox where an online seller answers WhatsApp, Instagram and Messenger customers, with their orders beside the chat
   Character quick, plain, shop-counter practical
   World     the shop counter and the order ledger: graphite surfaces, ledger-green ink for the one accent
   Moments   the conversation itself, and the order card beside it
   Signature the 24-hour reply window, always visible as a small ring with the time left
*/
:root {
  --bg: #fafafa; --card: #ffffff; --raised: #f4f4f5; --sunken: #f0f0f1;
  --text: #171717; --text-2: #525252; --text-3: #737373;
  --line: rgba(23, 23, 23, .09); --line-2: rgba(23, 23, 23, .14);
  --accent: #00695c; --accent-ink: #003f3b; --on-accent: #ffffff;
  --out: #ddf3ea; --out-line: rgba(0, 105, 92, .16);
  --sel: #eef4f1;
  --warn-bg: #fdf3dc; --warn-ink: #7a5200;
  --ok: #16803c; --bad: #c62828; --info: #1d5fb8;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .06);
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #141415; --card: #19191b; --raised: #232325; --sunken: #0f0f10;
  --text: #ededed; --text-2: #a1a1a6; --text-3: #85858b;
  --line: rgba(237, 237, 237, .09); --line-2: rgba(237, 237, 237, .15);
  --accent: #3f9b7b; --accent-ink: #6cc3a3; --on-accent: #08130f;
  --out: #1c332b; --out-line: rgba(108, 195, 163, .18);
  --sel: #1d2623;
  --warn-bg: #2e2612; --warn-ink: #e6c66a;
  --ok: #4cc38a; --bad: #ef6b6f; --info: #7ab0f5;
  --shadow-1: none; --shadow-2: 0 0 0 1px var(--line-2);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 400 14px/20px "Geist", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 6px; }
html { overflow: hidden; }
.sr { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { position: absolute; left: 8px; top: -40px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 8px; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg.i.s { width: 16px; height: 16px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
html { background: var(--bg); }
.app { display: grid; grid-template-columns: 56px 208px 336px minmax(0, 1fr) 320px; height: 100dvh; box-sizing: border-box; padding-top: env(safe-area-inset-top); background: var(--bg); }
.app.no-details { grid-template-columns: 56px 208px 336px minmax(0, 1fr); }
.app.no-details .details { display: none; }

/* ---------- inbox views ---------- */
.nav { background: var(--bg); border-right: 1px solid var(--line); padding: 12px 8px; overflow-y: auto; min-width: 0; }
.nav-head { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; margin-bottom: 8px; }
.nav-head h1 { font-size: 16px; line-height: 24px; font-weight: 600; flex: 1; }
.nav h2 { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text-3); padding: 0 8px; margin: 24px 0 8px; }
.nav-item { width: 100%; height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border-radius: 8px; color: var(--text-2); text-align: left; }
.nav-item + .nav-item { margin-top: 2px; }
.nav-item:hover { background: var(--raised); color: var(--text); }
.nav-item[aria-current="true"] { background: var(--card); color: var(--text); font-weight: 500; box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.nav-item .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { font-size: 12px; color: var(--text-3); font-weight: 400; }
.nav-item .ico { width: 18px; display: grid; place-items: center; flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--text-3)); flex: none; }

.rail { background: var(--sunken); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0; }
.mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; gap: 3px; padding: 8px 7px; margin-bottom: 12px; }
.mark span { display: block; height: 3px; border-radius: 2px; background: var(--on-accent); width: 100%; }
.mark span:last-child { width: 60%; justify-self: start; }
.rail-btn { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); transition: background-color .14s var(--ease), color .14s var(--ease); }
.rail-btn:hover { background: var(--raised); color: var(--text); }
.rail-btn.is-active { background: var(--card); color: var(--text); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.rail-space { flex: 1; }
.me { width: 28px; height: 28px; border-radius: 50%; background: var(--raised); border: 1px solid var(--line-2); font-size: 11px; font-weight: 500; display: grid; place-items: center; color: var(--text-2); margin-top: 8px; }

/* ---------- conversation list ---------- */
.list { display: flex; flex-direction: column; min-width: 0; background: var(--card); border-right: 1px solid var(--line); }
.list-head { padding: 0 12px 8px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 16px; height: 44px; margin: 0 -12px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tabs button { height: 44px; color: var(--text-3); font-weight: 500; position: relative; display: flex; align-items: center; gap: 6px; }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; }
.tabs .count { font-size: 12px; font-weight: 400; color: var(--text-3); }
.list-tools { display: flex; align-items: center; justify-content: space-between; height: 24px; padding: 0 4px; font-size: 13px; color: var(--text-2); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch i { width: 28px; height: 16px; border-radius: 8px; background: var(--line-2); position: relative; transition: background-color .16s var(--ease); }
.switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .16s var(--ease); }
.switch[aria-checked="true"] i { background: var(--accent); }
.switch[aria-checked="true"] i::after { transform: translateX(12px); }
.viewchips { display: none; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
.viewchips::-webkit-scrollbar { display: none; }
.viewchips .chip { flex: none; }
.demo-tag { font-size: 12px; line-height: 16px; color: var(--warn-ink); background: var(--warn-bg); padding: 2px 6px; border-radius: 5px; }
.search { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 8px; background: var(--raised); color: var(--text-3); border: 1px solid transparent; }
.search:focus-within { border-color: var(--accent); background: var(--card); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); }
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { display: none; }
kbd { font: 500 11px/16px inherit; color: var(--text-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; white-space: nowrap; }
.seg { display: flex; gap: 2px; background: var(--raised); padding: 2px; border-radius: 8px; }
.seg button { flex: 1; height: 28px; border-radius: 6px; font-size: 13px; color: var(--text-2); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button[aria-selected="true"] { background: var(--card); color: var(--text); font-weight: 500; box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.seg .count { color: var(--text-3); font-size: 12px; font-weight: 400; }
.channels { display: flex; gap: 4px; }
.chip { height: 28px; padding: 0 8px; border-radius: 8px; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); border: 1px solid transparent; }
.chip:hover { background: var(--raised); }
.chip[aria-pressed="true"] { border-color: var(--line-2); color: var(--text); background: var(--raised); font-weight: 500; }

.rows { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px; }
.row { width: 100%; height: 84px; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 8px; border-radius: 10px; text-align: left; }
.row-tags { display: flex; align-items: center; gap: 8px; min-width: 0; height: 20px; }
.row-tags .tag { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--card); }
.row-tags .who-sm { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; background: var(--raised); border: 1px solid var(--line-2); font-size: 10px; font-weight: 500; color: var(--text-2); display: grid; place-items: center; flex: none; }
.row-prev svg.dir { width: 14px; height: 14px; color: var(--info); flex: none; }
.row + .row { margin-top: 2px; }
.row:hover { background: var(--raised); }
.row[aria-current="true"] { background: var(--sel); }
.row-main { min-width: 0; display: grid; gap: 2px; }
.row-top, .row-bot { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row-time { font-size: 12px; color: var(--text-3); flex: none; }
.row-prev { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.row-prev span { overflow: hidden; text-overflow: ellipsis; }
.row.unread .row-prev { color: var(--text); }
.row.unread .row-time { color: var(--accent-ink); font-weight: 500; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; flex: none; }
.row .closed { color: var(--text-3); flex: none; display: grid; }
.empty { padding: 48px 24px; text-align: center; color: var(--text-3); display: grid; gap: 12px; justify-items: center; }

/* ---------- avatar ---------- */
.av { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 500; font-size: 14px; flex: none; background: var(--av-bg); color: var(--av-ink); }
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.av.sm { width: 32px; height: 32px; font-size: 12px; }
.av.lg { width: 56px; height: 56px; font-size: 18px; }
.ch { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--card); display: block; }
.row[aria-current="true"] .ch { border-color: var(--sel); }
.ch-ico { width: 16px; height: 16px; flex: none; display: block; }

/* ---------- thread ---------- */
.thread { display: flex; flex-direction: column; min-width: 0; background: var(--bg); outline: 0; }
.th-head { height: 56px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.th-who { flex: 1; min-width: 0; }
.th-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-sub { font-size: 12px; line-height: 16px; color: var(--text-3); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.win { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: 8px; font-size: 12px; color: var(--text-2); border: 1px solid var(--line); background: var(--card); white-space: nowrap; }
.win.closed { color: var(--warn-ink); background: var(--warn-bg); border-color: transparent; }
.ring { width: 16px; height: 16px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 2.5; }
.ring .t { stroke: var(--line-2); }
.ring .p { stroke: var(--accent); stroke-linecap: round; }
.ibtn { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2); flex: none; transition: background-color .14s var(--ease); }
.ibtn:hover { background: var(--raised); color: var(--text); }
.ibtn:active { transform: scale(.97); }
.ibtn[aria-pressed="true"] { background: var(--raised); color: var(--text); }
.ibtn[disabled] { opacity: .45; cursor: not-allowed; }
.back { display: none; }

.msgs { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 24px 8px; display: flex; flex-direction: column; gap: 2px; }
.msgs-inner { width: 100%; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 2px; }
.day { align-self: center; font-size: 12px; color: var(--text-3); margin: 12px 0 8px; padding: 2px 8px; border-radius: 6px; background: var(--raised); }
.m { max-width: min(520px, 78%); padding: 6px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); align-self: flex-start; overflow-wrap: anywhere; white-space: pre-wrap; }
.m.out { align-self: flex-end; background: var(--out); border-color: var(--out-line); }
.m.gap { margin-top: 8px; }
.m.in.tail { border-top-left-radius: 4px; }
.m.out.tail { border-top-right-radius: 4px; }
.m-meta { float: right; margin: 6px 0 -2px 12px; font-size: 11px; line-height: 16px; color: var(--text-3); display: inline-flex; align-items: center; gap: 3px; }
.m-meta svg { width: 14px; height: 14px; }
.m-meta .read { color: var(--info); }
.m-tag { display: block; font-size: 11px; line-height: 16px; color: var(--accent-ink); font-weight: 500; margin-bottom: 2px; }
.m-img { display: block; width: 240px; max-width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; margin: -1px -5px 6px; background: var(--raised); outline: 1px solid var(--line); object-fit: cover; }
.linkcard { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px; margin: 0 -4px 6px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); white-space: normal; min-width: 220px; }
.m.out .linkcard { background: color-mix(in srgb, var(--card) 70%, transparent); }
.linkcard .lc-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--raised); display: grid; place-items: center; color: var(--text-2); }
.linkcard b { font-weight: 500; display: block; }
.linkcard small { font-size: 12px; color: var(--text-3); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cta { clear: both; display: flex; align-items: center; justify-content: center; gap: 6px; margin: 8px -4px 0; padding: 8px 0 2px; border-top: 1px solid var(--out-line); color: var(--accent-ink); font-weight: 500; font-size: 13px; }
.composer { flex: none; padding: 8px 24px 16px; }
.comp-inner { max-width: 760px; margin: 0 auto; }
.comp-row { display: flex; align-items: flex-end; gap: 4px; }
.tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 2px 2px 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.ti { height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: 8px; color: var(--text); font-size: 13px; min-width: 0; text-align: left; }
.ti:hover { background: var(--raised); }
.ti svg { color: var(--text-2); }
.ti span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.att { position: relative; flex: none; width: 64px; height: 64px; border-radius: 8px; background: var(--raised); outline: 1px solid var(--line); display: grid; place-items: center; color: var(--text-2); }
.att img, .att video { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.att.doc { width: 168px; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; padding: 0 28px 0 10px; justify-items: start; }
.att-name { font-size: 12px; line-height: 16px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.att-x { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; }
.att-x svg { width: 12px; height: 12px; }
.att.add { outline-style: dashed; outline-color: var(--line-2); background: none; }
.att.add:hover { background: var(--raised); }
.comp-box { display: flex; flex-direction: column; padding: 6px; border-radius: 14px; background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow-1); position: relative; }
.comp-box:focus-within { border-color: var(--accent); }
.comp-box textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: none; padding: 6px 4px; max-height: 140px; line-height: 20px; }
.comp-box textarea::placeholder { color: var(--text-3); }
.send { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; transition: opacity .14s var(--ease); }
.send:active { transform: scale(.97); }
.send[disabled] { opacity: .4; cursor: default; }
.closed-bar { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; }
.closed-bar p { flex: 1; }
.btn { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; border: 1px solid var(--line-2); background: var(--card); color: var(--text); transition: background-color .14s var(--ease); }
.btn:hover { background: var(--raised); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-ink); }
[data-theme="dark"] .btn.primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn.sm { height: 28px; padding: 0 8px; }
.btn.block { width: 100%; }

.pop { position: absolute; left: 0; bottom: calc(100% + 8px); width: min(380px, 100%); background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-2); padding: 4px; z-index: 5; transform-origin: bottom left; animation: pop .18s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(4px); } }
.pop h3 { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 8px 8px 4px; }
.pop button { width: 100%; text-align: left; padding: 8px; border-radius: 8px; display: grid; gap: 2px; }
.pop button:hover { background: var(--raised); }
.pop button small { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pop-head { display: flex; align-items: center; gap: 4px; font-weight: 500; padding: 2px 2px 0; }
.pop-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop .pop-head button { width: 32px; display: grid; padding: 0; }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 8px; }
.pop.menu { width: 240px; }
.pop button.mi { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 6px 8px; }
.pop button.mi > span:last-child { display: grid; min-width: 0; }
.mi-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--raised); color: var(--text-2); display: grid; place-items: center; flex: none; overflow: hidden; }
.mi-ico img { width: 100%; height: 100%; object-fit: cover; }
.pop.emojis { left: auto; right: 0; width: 312px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; transform-origin: bottom right; }
.pop button.emo { display: grid; place-items: center; height: 36px; padding: 0; font-size: 22px; line-height: 1; }
.row-tags .ord { font-size: 12px; line-height: 16px; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; flex: none; }
.row-tags .ord.has { color: var(--accent-ink); font-weight: 500; }
.row-tags .ord svg { width: 14px; height: 14px; }

.blank { flex: 1; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--text-3); text-align: center; padding: 24px; }
.blank b { color: var(--text); font-weight: 500; font-size: 16px; }

/* ---------- details ---------- */
.details { background: var(--card); border-left: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; min-width: 0; }
.d-head { display: none; }
.d-sec { padding: 16px; border-bottom: 1px solid var(--line); }
.d-sec:last-child { border-bottom: 0; }
.d-sec h2 { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--text-2); margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.d-sec h2 span { font-weight: 400; color: var(--text-3); }
.who { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: center; }
.who b { font-weight: 500; font-size: 16px; line-height: 24px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { font-size: 13px; color: var(--text-3); display: block; }
.kv { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 4px 8px; font-size: 13px; margin-top: 12px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 12px; line-height: 16px; padding: 2px 6px; border-radius: 5px; background: var(--raised); color: var(--text-2); border: 1px solid var(--line); }
.order { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg); }
.order + .order { margin-top: 8px; }
.o-top { display: flex; align-items: center; gap: 8px; }
.o-top b { font-weight: 500; flex: 1; }
.st { font-size: 12px; line-height: 16px; padding: 2px 6px; border-radius: 5px; display: inline-flex; align-items: center; gap: 5px; background: var(--raised); color: var(--text-2); }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.ok { color: var(--ok); } .st.wait { color: var(--warn-ink); } .st.move { color: var(--info); } .st.bad { color: var(--bad); }
.o-items { font-size: 13px; color: var(--text-2); margin: 4px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-sum { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-3); }
.o-sum b { color: var(--text); font-weight: 500; }
.o-act { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.note { width: 100%; min-height: 72px; resize: vertical; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); padding: 8px; outline: 0; }
.note:focus { border-color: var(--accent); }
.muted { color: var(--text-3); font-size: 13px; }

/* ---------- sign-in + live-only pieces ---------- */
.is-live .demo-tag { display: none; }
.auth { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; }
.auth[hidden] { display: none; }
.auth-card { width: min(360px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-2); padding: 24px; display: grid; gap: 12px; }
.auth-card .mark { margin: 0 0 4px; }
.auth-card h1 { font-size: 20px; line-height: 28px; font-weight: 600; }
.auth-form { display: grid; gap: 6px; }
.auth-form label { font-size: 13px; font-weight: 500; color: var(--text-2); margin-top: 6px; }
.auth-form input, .inp { height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); min-width: 0; width: 100%; }
.auth-form input:focus, .inp:focus { outline: 0; border-color: var(--accent); }
.auth-form .btn { height: 36px; margin-top: 8px; }
.auth-form .textbtn { justify-self: center; font-size: 13px; }
.auth-err { min-height: 20px; font-size: 13px; color: var(--bad); }
.rowed { display: grid; gap: 8px; justify-items: start; }
.rowed-row { display: flex; gap: 8px; width: 100%; align-items: center; }
.rowed-row .inp { width: 160px; flex: none; }
.rowed-row .inp.grow { flex: 1; width: auto; }
.notice.ok { background: var(--sel); color: var(--accent-ink); }
.prompt.keyrow { grid-template-columns: minmax(0, 1fr) auto; }
.card > header + header, .card .field + header { border-top: 1px solid var(--line); margin-top: 4px; }
.pop-empty { padding: 12px 8px; }
.m-audio { display: block; width: 240px; max-width: 100%; height: 36px; margin: 0 -4px 6px; }

/* ---------- calls ---------- */
.calls-top { padding: 8px 4px; display: grid; gap: 8px; }
.calls-top .notice { margin: 0; }
.call-row .row-prev.missed { color: var(--bad); }
.call { position: fixed; right: 24px; bottom: 24px; z-index: 35; width: 340px; background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-2); padding: 16px; display: grid; gap: 12px; animation: pop .22s var(--ease); }
.call-who { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: center; }
.call-who b { display: block; font-size: 16px; line-height: 24px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-who small { font-size: 13px; color: var(--text-2); }
.call.active .call-who small { color: var(--ok); font-weight: 500; }
.call-info { display: flex; flex-wrap: wrap; gap: 4px; }
.call-info .tag { display: inline-flex; align-items: center; gap: 5px; }
.call-act { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 4px; }
.cbtn { display: grid; justify-items: center; gap: 6px; padding: 4px 0; border-radius: 12px; }
.cbtn span { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--raised); color: var(--text); border: 1px solid var(--line); transition: background-color .14s var(--ease); }
.cbtn small { font-size: 12px; line-height: 16px; color: var(--text-2); }
.cbtn:hover span { background: var(--sunken); }
.cbtn:active span { transform: scale(.97); }
.cbtn.ok span { background: var(--ok); color: #fff; border-color: transparent; }
.cbtn.bad span { background: var(--bad); color: #fff; border-color: transparent; }
.cbtn.bad svg { transform: rotate(135deg); }
.cbtn.on span { background: var(--text); color: var(--bg); border-color: transparent; }
.cbtn.ok:hover span, .cbtn.bad:hover span { filter: brightness(1.08); }

/* ---------- settings ---------- */
.settings { display: none; background: var(--bg); min-width: 0; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.set-scroll { overflow-y: auto; min-width: 0; }
.set-nav h2:first-of-type { margin-top: 8px; }
.app.app[data-screen="settings"], .app.app.no-details[data-screen="settings"] { grid-template-columns: 56px minmax(0, 1fr); }
.app[data-screen="settings"] > .nav, .app[data-screen="settings"] > .list, .app[data-screen="settings"] > .thread { display: none; }
.app[data-screen="settings"] > .details { display: none !important; }
.app[data-screen="settings"] > .settings { display: grid; }
.app[data-screen="settings"] > .settings > .nav { display: flex; align-items: center; gap: 4px; overflow-x: auto; padding: 8px 24px; border-right: 0; border-bottom: 1px solid var(--line); background: var(--card); scrollbar-width: none; }
.set-nav .nav-head { margin: 0 12px 0 0; padding: 0; flex: none; }
.set-nav h2 { display: none; }
.set-nav .nav-item { width: auto; flex: none; padding: 0 12px; }
.set-nav .nav-item + .nav-item { margin-top: 0; }
.set-nav .nav-item[aria-current="true"] { background: var(--sel); color: var(--accent-ink); box-shadow: none; }
.me { cursor: pointer; }
.set-inner { max-width: 720px; margin: 0; padding: 20px 24px 48px; display: grid; gap: 16px; }
.set-inner h1 { font-size: 20px; line-height: 28px; font-weight: 600; }
.set-inner .seg { max-width: 420px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-1); }
.card > header { padding: 16px 16px 12px; }
.card h2 { font-size: 16px; line-height: 24px; font-weight: 600; }
.card > header p { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.card > footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.days { padding: 0 16px 8px; }
.day-row { display: grid; grid-template-columns: 104px 96px minmax(0, 1fr); align-items: center; gap: 12px; height: 44px; }
.day-row + .day-row { border-top: 1px solid var(--line); }
.day-name { font-weight: 500; }
.times { display: flex; align-items: center; gap: 8px; justify-content: flex-end; color: var(--text-3); font-size: 13px; }
.times input { height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); font-variant-numeric: tabular-nums; }
.times input:focus { outline: 0; border-color: var(--accent); }
.day-row.off .times { visibility: hidden; }
.field { padding: 0 16px 12px; display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .switch { justify-self: start; }
.note[disabled] { opacity: .55; }
.notice { display: flex; gap: 8px; align-items: flex-start; margin: 0 16px 12px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; }
.notice svg { margin-top: 2px; }
.prompts { border-top: 1px solid var(--line); }
.prompt { display: grid; grid-template-columns: 24px minmax(0, 1fr) 260px auto; align-items: center; gap: 12px; padding: 8px 16px; min-height: 52px; }
.prompt + .prompt { border-top: 1px solid var(--line); }
.p-no { color: var(--text-3); font-size: 12px; }
.p-name { display: grid; min-width: 0; }
.p-name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-name small { font-size: 12px; color: var(--accent-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prompt audio { width: 100%; height: 32px; }

/* ---------- order strip + link dialog ---------- */
.strip { flex: none; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); font-size: 13px; }
.strip-ico { color: var(--text-3); display: grid; flex: none; }
.strip-text { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; }
.strip-text b { font-weight: 500; }
.only-m { display: none; font-weight: 500; }
.strip-total { color: var(--text); }
.strip-items { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.strip .tag { white-space: nowrap; flex: none; }
.d-sec h2 .btn { font-weight: 500; color: var(--text); }
.o-linked { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-3); margin: -4px 0 8px; }
.textbtn { font-size: 12px; color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; padding: 4px 0; }
.textbtn:hover { color: var(--text); }
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; width: 100%; cursor: default; }
.dialog { position: fixed; z-index: 31; left: 50%; top: 12vh; transform: translateX(-50%); width: min(520px, calc(100% - 24px)); max-height: 76vh; display: flex; flex-direction: column; gap: 12px; background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-2); padding: 16px; }
.dialog header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px -4px -4px 0; }
.dialog h2 { font-size: 16px; line-height: 24px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-list { overflow-y: auto; margin: 0 -8px; padding: 0 8px; display: grid; gap: 8px; }
.pick { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.pick-main { flex: 1; min-width: 0; }
.pick-main .o-items { margin: 4px 0; }
.pick-side { display: grid; gap: 8px; justify-items: end; align-content: space-between; flex: none; }
.pick-side b { font-weight: 500; }

/* ---------- toast ---------- */
.toasts { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 40; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow-2); animation: pop .2s var(--ease); display: flex; align-items: center; gap: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1440px) {
  .app { grid-template-columns: 56px 320px minmax(0, 1fr) 304px; }
  .app.no-details { grid-template-columns: 56px 320px minmax(0, 1fr); }
  .nav { display: none; }
  .viewchips { display: flex; }
}
@media (max-width: 1180px) {
  .app, .app.no-details { grid-template-columns: 56px 320px minmax(0, 1fr); }
  .details { position: fixed; inset: 0 0 0 auto; width: min(360px, 100%); z-index: 20; box-shadow: var(--shadow-2); transform: translateX(100%); transition: transform .28s var(--ease); display: block !important; }
  .app:not(.no-details) .details { transform: none; }
  .d-head { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); font-weight: 500; }
}
@media (max-width: 760px) {
  .app, .app.no-details { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .rail { grid-row: 2; flex-direction: row; justify-content: center; gap: 24px; padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .rail .mark { display: none; }
  /* phone: logo and Inbox on the left, Settings / theme / account on the right; the bar shows on the chat list only */
  .rail { justify-content: flex-start; gap: 8px; padding-left: 16px; padding-right: 16px; }
  .rail .brand-logo { margin: 0 8px 0 0; }
  .rail-space { display: block; flex: 1; order: 2; }
  .rail-btn[data-screen="settings"] { order: 3; }
  .rail #themeBtn { order: 4; }
  .rail .me { order: 5; margin-left: 4px; }
  .me { margin: 0; }
  .list { border-right: 0; }
  .thread { display: none; }
  .app[data-view="thread"] .list, .app[data-view="thread"] .rail { display: none; }
  .app[data-view="thread"] .thread { display: flex; grid-row: 1 / -1; }
  .back { display: grid; }
  .th-head { padding: 0 8px; gap: 8px; }
  .win span.long, .th-head .ibtn[disabled], .th-head .btn .long, .strip-items, .strip .tag { display: none; }
  .th-head .btn { width: 44px; height: 44px; padding: 0; border-color: transparent; background: none; }
  .strip { padding: 0 12px; height: 44px; }
  .auth-form input, .inp { height: 44px; font-size: 16px; }
  .auth-form .btn { height: 44px; }
  .rowed-row { flex-wrap: wrap; }
  .rowed-row .inp { width: auto; flex: 1 1 120px; }
  .app[data-screen="settings"] > .settings > .nav { padding: 8px 12px; }
  .set-nav .nav-head { display: none; }
  .set-inner .seg { overflow-x: auto; }
  .set-inner .seg button { flex: none; padding: 0 12px; }
  .call { inset: 0; width: auto; border: 0; border-radius: 0; padding: 72px 24px calc(40px + env(safe-area-inset-bottom)); grid-template-rows: auto auto 1fr; align-content: start; }
  .call-who { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 16px; }
  .call-who .av { width: 96px; height: 96px; font-size: 32px; }
  .call-who b { font-size: 22px; line-height: 28px; }
  .call-who small { font-size: 15px; }
  .call-info { justify-content: center; }
  .call-act { align-self: end; }
  .cbtn span { width: 64px; height: 64px; }
  .cbtn span svg { width: 24px; height: 24px; }
  .cbtn small { font-size: 13px; }
  .app.app[data-screen="settings"], .app.app.no-details[data-screen="settings"] { grid-template-columns: minmax(0, 1fr); }
  .set-inner { padding: 16px 12px 32px; }
  .set-inner .seg { max-width: none; }
  .set-inner .seg button { height: 36px; }
  .day-row { grid-template-columns: minmax(0, 1fr) auto; height: auto; padding: 10px 0; row-gap: 8px; }
  .day-row .times { grid-column: 1 / -1; justify-content: flex-start; }
  .day-row.off .times { display: none; }
  .times input { height: 40px; font-size: 16px; }
  .prompt { grid-template-columns: 24px minmax(0, 1fr) auto; row-gap: 8px; padding: 12px; }
  .prompt audio { grid-column: 1 / -1; grid-row: 2; height: 40px; }
  .prompt .btn, .card > footer .btn { height: 40px; }
  .card > footer { flex-wrap: wrap; }
  .pop, .pop.menu, .pop.emojis { position: fixed; left: 8px; right: 8px; bottom: calc(76px + env(safe-area-inset-bottom)); width: auto; }
  .pop button.mi { min-height: 48px; }
  .ti { height: 44px; gap: 6px; padding: 0 6px; }
  .pop button.emo { height: 44px; }
  .strip .btn, .pick .btn { height: 36px; }
  .dialog { top: auto; bottom: 0; left: 0; transform: none; width: 100%; max-height: 86dvh; border-radius: 16px 16px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .dialog .search input { font-size: 16px; }
  .msgs { padding: 12px 12px 8px; }
  .composer { padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); }
  .m { max-width: 86%; }
  .tabs button { height: 44px; }
  .nav-item, .chip { height: 36px; }
  .search input, .comp-box textarea, .note { font-size: 16px; }
  .rail-btn, .ibtn, .send { width: 44px; height: 44px; }
  kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* the product logo (files in brand/, cut from the owner's approved logo sheet) */
.brand-logo { width: 32px; height: auto; object-fit: contain; margin-bottom: 12px; }
.auth-logo { height: 42px; width: auto; max-width: 100%; object-fit: contain; object-position: left; display: block; margin-bottom: 6px; }

/* ---------- sign-in, sign-up, verify email, choose a plan ---------- */
.auth { padding: 24px 16px; place-items: center; }
.auth-wrap { width: min(920px, 100%); display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-2); overflow: hidden; margin: auto; }
.auth-wrap.wide { width: min(1200px, 100%); grid-template-columns: 1fr; }
.auth-side { padding: 40px; display: grid; align-content: start; gap: 16px; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 5%, var(--card)), color-mix(in srgb, var(--accent) 16%, var(--card))); border-right: 1px solid var(--line); }
.auth-side .auth-logo { height: 48px; margin-bottom: 16px; }
.auth-side h2 { font-size: 26px; line-height: 34px; font-weight: 600; letter-spacing: -.01em; color: var(--text); text-wrap: balance; }
.auth-side h2 em { font-style: normal; color: var(--accent); }
.auth-side > p { font-size: 14px; line-height: 22px; color: var(--text-2); max-width: 34ch; }
.auth-feats { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 14px; }
.auth-feats li { display: flex; align-items: center; gap: 12px; }
.auth-feats b { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.auth-feats small { display: block; font-size: 13px; color: var(--text-2); }
.auth-fi { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--card); color: var(--accent); border: 1px solid var(--line); }
.auth-wrap .auth-card { width: auto; border: 0; border-radius: 0; box-shadow: none; padding: 40px; align-content: center; gap: 10px; background: var(--card); }
.auth-wrap:not(.wide) .card-logo { display: none; }
.auth-card h1 { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -.01em; }
.auth-card > .muted { font-size: 14px; line-height: 20px; margin-bottom: 4px; }
.auth-form .inp, .auth-form input:not([type="checkbox"]) { height: 44px; font-size: 16px; border-radius: 10px; }
.auth-pw { position: relative; display: block; }
.auth-pw .inp, .auth-pw input { padding-right: 44px; width: 100%; }
.auth-eye { position: absolute; right: 2px; top: 2px; width: 40px; height: 40px; display: grid; place-items: center; color: var(--text-2); border-radius: 8px; background: none; border: 0; cursor: pointer; }
.auth-eye:hover { color: var(--text); }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.auth-form label.auth-check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; color: var(--text-2); cursor: pointer; }
.auth-check input { width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.auth-link { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); cursor: pointer; }
.auth-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-err.ok { color: var(--accent); }
.auth-card .btn.block { width: 100%; height: 44px; font-size: 15px; border-radius: 10px; }
.auth-card .btn.ghost { border-color: transparent; background: none; color: var(--text-2); }
.auth-alt { text-align: center; font-size: 13px; color: var(--text-2); margin-top: 6px; }
.plans { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 8px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px 16px 16px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--card); min-width: 0; }
.plan.hot { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-tag { position: absolute; top: -10px; left: 16px; height: 20px; padding: 0 8px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; line-height: 20px; }
.plan h3 { font-size: 16px; font-weight: 600; }
.plan-for { font-size: 13px; line-height: 18px; color: var(--text-2); min-height: 36px; }
.plan-price { display: flex; align-items: baseline; gap: 4px; margin-top: 4px; }
.plan-price b { font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -.01em; }
.plan-price small { font-size: 13px; color: var(--text-2); }
.plan-setup { font-size: 12px; line-height: 18px; color: var(--text-2); min-height: 36px; }
.plan-setup s { opacity: .7; }
.plan-setup span { font-weight: 600; color: var(--text); }
.plan ul { list-style: none; margin: 6px 0 14px; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 8px; flex: 1; align-content: start; }
.plan li { display: flex; gap: 8px; font-size: 13px; line-height: 18px; color: var(--text); }
.plan li .i { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-eye .i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.plan .btn.block { text-decoration: none; }
.plan-notes { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 12px; line-height: 18px; color: var(--text-2); }
@media (max-width: 1100px) { .plans { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .auth { padding: 0; place-items: stretch; background: var(--card); }
  .auth-wrap, .auth-wrap.wide { grid-template-columns: 1fr; border: 0; border-radius: 0; box-shadow: none; width: 100%; margin: 0; }
  .auth-side { display: none; }
  .auth-wrap .auth-card { padding: 28px 20px 32px; align-content: start; }
  .auth-wrap:not(.wide) .card-logo { display: block; margin-bottom: 12px; }
  .plans { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .plans { grid-template-columns: 1fr; } .plan-for, .plan-setup { min-height: 0; } }

/* ---------- inbox side list (All, Mine, Closed, labels): hidden until the Inbox button is pressed again ---------- */
@media (min-width: 1441px) {
  .app:not(.nav-open):not([data-screen="settings"]) { grid-template-columns: 56px 336px minmax(0, 1fr) 320px; }
  .app:not(.nav-open).no-details:not([data-screen="settings"]) { grid-template-columns: 56px 336px minmax(0, 1fr); }
  .app:not(.nav-open) > .nav { display: none; }
  .app:not(.nav-open) .viewchips { display: flex; }
}
@media (min-width: 1181px) and (max-width: 1440px) {
  .app.nav-open:not([data-screen="settings"]) { grid-template-columns: 56px 208px 320px minmax(0, 1fr) 304px; }
  .app.nav-open.no-details:not([data-screen="settings"]) { grid-template-columns: 56px 208px 320px minmax(0, 1fr); }
  .app.nav-open:not([data-screen="settings"]) > .nav { display: block; }
  .app.nav-open .viewchips { display: none; }
}
/* labels in the customer panel */
.tag.has-x { display: inline-flex; align-items: center; gap: 4px; padding-right: 2px; }
.tag-x { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 4px; color: var(--text-3); }
.tag-x:hover { background: var(--line-2); color: var(--text); }
.label-add { display: flex; gap: 8px; margin-top: 8px; }
.label-add .inp { height: 28px; font-size: 13px; }
@media (max-width: 760px) { .label-add .inp { height: 36px; font-size: 16px; } }

/* ---------- voice note being recorded ---------- */
.comp-row[hidden] { display: none; }
.rec-row { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); flex: none; margin-left: 4px; }
.rec-dot.paused { background: var(--text-3); }
.rec-time { font-size: 14px; font-weight: 500; min-width: 36px; }
.rec-hint { flex: 1; font-size: 13px; color: var(--text-2); }
.m-audio { display: block; width: 240px; max-width: 100%; height: 36px; margin: 2px 0; }

@media (max-width: 760px) { .auth { padding-top: env(safe-area-inset-top); } }

/* ---------- photo / video bubbles: the picture fills the bubble, the time sits on it ---------- */
.m.media { padding: 3px; position: relative; max-width: min(320px, 78%); }
.m.media .m-img { display: block; width: auto; height: auto; max-width: 100%; max-height: 360px; min-width: 140px; min-height: 100px; aspect-ratio: auto; margin: 0; border-radius: 10px; outline: 0; object-fit: cover; cursor: zoom-in; }
.m.media video.m-img { cursor: default; width: 100%; background: #000; }
.m.media .m-tag { margin: 2px 6px 4px; }
.m.media .m-cap { display: block; padding: 4px 7px 2px; }
.m-meta.over { position: absolute; right: 9px; bottom: 8px; float: none; margin: 0; padding: 1px 7px; border-radius: 10px; background: rgba(0, 0, 0, .5); color: #fff; }
.m-meta.over .read { color: #8fd3ff; }
.m.media video.gif + .m-meta.over::before { content: "GIF"; font-weight: 600; margin-right: 6px; }
/* ---------- voice note bubble ---------- */
.m.voice { padding: 6px 10px 4px 6px; min-width: 250px; }
.vn { display: flex; align-items: center; gap: 8px; }
.vn-av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent); color: var(--on-accent); }
.vn-av svg { width: 18px; height: 18px; }
.m.in .vn-av { background: var(--raised); color: var(--text-2); }
.vn-play { width: 32px; height: 32px; display: grid; place-items: center; flex: none; color: var(--text-2); border-radius: 50%; }
.vn-play svg { width: 22px; height: 22px; }
.vn-play:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.vn-body { flex: 1; min-width: 110px; display: grid; gap: 4px; padding-top: 10px; }
.vn-track { display: block; height: 12px; cursor: pointer; position: relative; }
.vn-track::before { content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--text) 18%, transparent); }
.vn-fill { position: absolute; left: 0; top: 4px; height: 4px; border-radius: 2px; background: var(--accent); max-width: 100%; }
.vn-fill::after { content: ""; position: absolute; right: -6px; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.vn-time { font-size: 11px; line-height: 14px; color: var(--text-3); }
.m.voice .m-meta { margin-top: -14px; }
/* ---------- emoji picker ---------- */
.pop.emojis { max-height: 320px; overflow-y: auto; }
.emo-h { grid-column: 1 / -1; font-size: 11px; font-weight: 500; color: var(--text-3); padding: 6px 4px 2px; }
.emo-h.tip { padding-top: 10px; }
.rec-send[disabled] { opacity: 1; }

/* ---------- the page itself never scrolls: only the chat list and the open chat do ---------- */
.app { grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.rail, .nav, .list, .thread, .details, .settings { min-height: 0; }
.msgs { min-height: 0; }
/* ---------- video in a chat: a still picture with its length, opens in the viewer ---------- */
.m-vid { position: relative; display: block; cursor: pointer; border-radius: 10px; overflow: hidden; background: var(--raised); min-width: 180px; min-height: 120px; }
.m.media .m-vid .m-img { width: 100%; background: var(--raised); cursor: pointer; display: block; }
.vid-play { position: absolute; inset: 0; margin: auto; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .5); color: #fff; pointer-events: none; }
.vid-play svg { width: 24px; height: 24px; }
.vid-dur { position: absolute; left: 9px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 10px; background: rgba(0, 0, 0, .5); color: #fff; font-size: 11px; line-height: 16px; pointer-events: none; }
.vid-dur svg { width: 12px; height: 12px; } .vid-dur i { font-style: normal; }
.m-vid.gif .vid-play, .m-vid.gif .vid-dur { display: none; }
.m.media .m-vid.gif ~ .m-meta.over::before { content: "GIF"; font-weight: 600; margin-right: 6px; }
/* ---------- sending, not sent, quoted reply, reactions ---------- */
.m-prog { position: absolute; left: 9px; top: 8px; padding: 1px 7px; border-radius: 10px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; line-height: 16px; }
.m:not(.media) .m-prog { position: static; display: block; background: none; color: var(--text-3); padding: 2px 0 0; clear: both; }
.m-again { display: flex; align-items: center; gap: 6px; clear: both; margin: 4px 2px 2px; height: 28px; padding: 0 8px; border-radius: 8px; font-size: 12px; font-weight: 500; color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.m-quote { display: block; margin: 0 0 4px; padding: 4px 8px; border-left: 3px solid var(--accent); border-radius: 6px; background: color-mix(in srgb, var(--text) 6%, transparent); font-size: 12px; line-height: 16px; color: var(--text-2); white-space: normal; }
.m-quote b { display: block; font-weight: 500; color: var(--accent); }
.m.media .m-quote { margin: 2px 2px 4px; }
.m { position: relative; }
.m.has-react { margin-bottom: 14px; }
.m-react { position: absolute; left: 8px; bottom: -13px; padding: 0 5px; height: 22px; border-radius: 11px; background: var(--card); border: 1px solid var(--line); font-size: 13px; line-height: 20px; white-space: nowrap; }
.m.out .m-react { left: auto; right: 8px; }
.m-act { position: absolute; top: 2px; right: -30px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); opacity: 0; transition: opacity .14s var(--ease); }
.m.out .m-act { right: auto; left: -30px; }
.m:hover .m-act, .m-act:focus-visible, .m-act[aria-expanded="true"] { opacity: 1; }
.m-act:hover { background: var(--raised); color: var(--text-2); }
.m-reacts { position: absolute; top: -40px; left: 0; z-index: 5; display: flex; gap: 2px; padding: 4px; border-radius: 20px; background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow-2); white-space: nowrap; }
.m.out .m-reacts { left: auto; right: 0; }
.m-reacts button, .v-reacts button { width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; display: grid; place-items: center; }
.m-reacts button:hover, .v-reacts button:hover { background: var(--raised); }
/* ---------- composer: mic while empty, Send once there is something to send ---------- */
.comp-row .send.mic { display: grid; }
.comp-row.has-text .send.mic { display: none; }
.comp-row:not(.has-text) .send:not(.mic) { display: none; }
/* ---------- photo and video viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: #0b0b0c; color: #fff; }
.viewer > header { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 12px; }
.viewer .ibtn { color: #fff; } .viewer .ibtn:hover { background: rgba(255, 255, 255, .12); }
.v-who { flex: 1; min-width: 0; display: grid; } .v-who b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .v-who small { font-size: 12px; color: rgba(255, 255, 255, .65); }
.v-stage { display: grid; place-items: center; min-height: 0; padding: 8px; }
.v-stage { overflow: hidden; }
.v-stage img, .v-stage video { max-width: 100%; max-height: calc(100dvh - 190px); width: auto; height: auto; object-fit: contain; border-radius: 4px; }
.viewer.bare .v-stage img, .viewer.bare .v-stage video { max-height: calc(100dvh - 76px); }
.viewer > footer { display: grid; gap: 8px; justify-items: center; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); }
.v-reacts { display: flex; gap: 4px; } .v-reacts button:hover { background: rgba(255, 255, 255, .14); }
.v-reply { display: flex; gap: 8px; width: min(560px, 100%); }
.v-reply .inp { flex: 1; height: 36px; background: #1c1c1f; border-color: #2c2c30; color: #fff; }
.v-reply .send { width: 36px; height: 36px; }
.att img, .att video { cursor: zoom-in; }
@media (max-width: 760px) { .m-act { display: none; } .v-reply .inp { height: 44px; font-size: 16px; } .v-reply .send { width: 44px; height: 44px; } }

/* ---------- chat list row: handler's initials top right, time bottom right ---------- */
.row-top .who-sm { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; background: var(--raised); border: 1px solid var(--line-2); font-size: 9px; font-weight: 500; color: var(--text-2); display: grid; place-items: center; flex: none; }
.row-tags .row-time { margin-left: auto; }
/* ---------- Settings > Channels: one card per channel ---------- */
.ch-head { display: flex; align-items: center; gap: 12px; }
.ch-logo { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--raised); flex: none; }
.ch-logo svg { width: 22px; height: 22px; }
.ch-title { flex: 1; min-width: 0; }
.pill { font-size: 12px; line-height: 20px; padding: 0 8px; border-radius: 6px; background: var(--raised); color: var(--text-2); white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent-ink); }

/* Link order window: nothing scrolls sideways; a long product name is cut with three dots */
.dlg-list { overflow-x: hidden; grid-template-columns: minmax(0, 1fr); }
.dlg-list .pick { min-width: 0; }
.pick-main { flex: 1; min-width: 0; }
.pick-main .o-top { min-width: 0; }
.pick-main .o-top b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-main .o-top .st { flex: none; }
.pick-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .btn { flex: none; align-self: center; }
/* ready labels under the label box */
.label-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.label-quick .tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); font-size: 12px; color: var(--text-2); cursor: pointer; }
.label-quick .tag:hover { background: var(--raised); color: var(--text); }

/* approved templates list in Settings > Channels */
.tpl-list { margin: 0 16px 12px; font-size: 13px; }
.tpl-list summary { cursor: pointer; color: var(--text-2); height: 32px; display: flex; align-items: center; }
.tpl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.tpl b { font-weight: 500; }
.tpl small { grid-column: 1 / -1; color: var(--text-3); font-size: 12px; overflow-wrap: anywhere; }
.tpl p { grid-column: 1 / -1; margin: 4px 0 0; white-space: pre-wrap; color: var(--text-2); }

/* links inside a message */
.m a { color: var(--info, #0a66c2); text-decoration: underline; overflow-wrap: anywhere; }
