:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --rail: #1f2a24;
  --rail-text: #cfd8d2;
  --line: #e4e0d8;
  --text: #1d1f1e;
  --muted: #6d716e;
  --accent: #1e7a4f;
  --accent-soft: #e2f1e8;
  --mine: #dcf3e4;
  --theirs: #ffffff;
  --danger: #b3261e;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }

.app {
  display: grid;
  grid-template-columns: 72px minmax(280px, 360px) 1fr;
  height: 100vh;
}

/* Numbers rail */
.numbers {
  background: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
}
.numbers-list { display: flex; flex-direction: column; gap: 10px; }
.number-btn, .add-number {
  width: 46px; height: 46px;
  border-radius: 14px;
  border: 0;
  position: relative;
  font-weight: 600;
  font-size: 15px;
}
.number-btn { background: #34443b; color: var(--rail-text); }
.number-btn.active { background: var(--accent); color: #fff; }
.number-btn .dot {
  position: absolute; right: -2px; bottom: -2px;
  display: block;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--rail);
  background: #9aa39e;
}
.number-btn .dot.connected { background: #3ccf7f; }
.number-btn .dot.qr, .number-btn .dot.connecting, .number-btn .dot.reconnecting { background: #f2b33d; }
.number-btn .dot.logged_out { background: #e5584f; }
.number-btn .badge, .chat .badge {
  background: #e5584f; color: #fff;
  font-size: 11px; font-weight: 600;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
}
.number-btn .badge { position: absolute; top: -5px; right: -6px; }
.add-number { background: transparent; color: var(--rail-text); border: 1.5px dashed #56665c; font-size: 22px; }

/* Chat list */
.chats {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
}
.chats-head { padding: 18px 16px 10px; }
.chats-head h1 { font-size: 19px; }
.search-wrap { padding: 0 16px 10px; }
.search-wrap input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
}
.filters { display: flex; gap: 6px; padding: 0 16px 10px; }
.filter {
  border: 1px solid var(--line); background: transparent;
  border-radius: 999px; padding: 4px 12px; font-size: 13px;
}
.filter.active { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.chat {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f1eee8;
}
.chat:hover { background: #faf8f5; }
.chat.active { background: var(--accent-soft); }
.chat .name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat .last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: var(--muted); }
.chat.unread .name { color: var(--text); }
.chat.unread .when { color: var(--accent); font-weight: 600; }
.chat-list .note { padding: 24px 16px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #d9e6de; color: #2f5a43;
  display: grid; place-items: center;
  font-weight: 600; font-size: 15px;
  flex-shrink: 0;
}

/* Thread */
.thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.empty { flex: 1; display: grid; place-items: center; color: var(--muted); }
.thread-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.thread-head h2 { font-size: 16px; }
.back { display: none; border: 0; background: none; font-size: 28px; line-height: 1; padding: 0 6px 0 0; }
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 6%;
  display: flex; flex-direction: column; gap: 4px;
}
.day {
  align-self: center;
  background: #e9e5dd; color: var(--muted);
  font-size: 12px; padding: 3px 10px; border-radius: 6px;
  margin: 10px 0 6px;
}
.bubble {
  max-width: min(560px, 78%);
  padding: 7px 10px 5px;
  border-radius: 10px;
  background: var(--theirs);
  box-shadow: 0 1px 0 rgba(0,0,0,.06);
  align-self: flex-start;
  overflow-wrap: anywhere;
  font-size: 14.5px;
  line-height: 1.4;
}
.bubble .body { white-space: pre-wrap; }
.bubble.mine { background: var(--mine); align-self: flex-end; }
.bubble .foot { display: flex; justify-content: flex-end; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.bubble .tick.read { color: #2b8fd6; }
.bubble .tick.failed { color: var(--danger); }
.bubble img, .bubble video { display: block; max-width: 100%; max-height: 320px; border-radius: 6px; margin-bottom: 4px; }
.bubble audio { display: block; width: 260px; max-width: 100%; }
.bubble .sticker { max-width: 140px; background: none; }
.bubble a { color: var(--accent); }
.bubble .doc { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; }
.load-older { align-self: center; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 14px; font-size: 13px; margin-bottom: 8px; }

.composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px 20px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 160px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  line-height: 1.4;
}
.composer button[type=submit], .dialog-actions button {
  background: var(--accent); color: #fff;
  border: 0; border-radius: var(--radius);
  padding: 10px 18px; font-weight: 600;
}
.composer button[type=submit]:disabled { opacity: .5; cursor: default; }

/* Link dialog */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20, 28, 24, .45); }
.dialog-body { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.dialog-body h3 { font-size: 18px; }
.dialog-body label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
.dialog-body input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dialog-actions .secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.steps { margin: 0; padding-left: 20px; line-height: 1.7; font-size: 14px; }
.qr-box { display: grid; place-items: center; min-height: 300px; background: var(--bg); border-radius: var(--radius); }
.qr-box img { width: 280px; height: 280px; }
.qr-box .done { color: var(--accent); font-weight: 600; font-size: 16px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #2b2f2d; color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 14px;
  max-width: calc(100vw - 32px);
}

/* Phone width: one column at a time */
@media (max-width: 760px) {
  .app { grid-template-columns: 60px 1fr; }
  .number-btn, .add-number { width: 40px; height: 40px; }
  .thread { display: none; }
  .app.reading .chats { display: none; }
  .app.reading .thread { display: flex; }
  .back { display: block; }
  .messages { padding: 14px 12px; }
  .composer { padding: 10px 12px; }
  .bubble { max-width: 88%; }
}

/* ---------- Team features ---------- */

:root {
  --note: #fff6d6;
  --note-line: #f0dc8f;
  --warn: #b3261e;
  --warn-soft: #fde7e5;
  --info: #285ea8;
  --info-soft: #e3ecfa;
}

/* Login */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card {
  background: var(--panel); border-radius: 14px; padding: 28px;
  width: min(360px, 100%); display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,.08);
}
.login-card h1 { font-size: 22px; }
.login-card label { font-size: 13px; color: var(--muted); margin-top: 8px; }
.login-card input { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.login-card button { margin-top: 14px; background: var(--accent); color: #fff; border: 0; border-radius: var(--radius); padding: 11px; font-weight: 600; }
.login-error { color: var(--warn); font-size: 14px; }

/* Rail: my account at the bottom */
.rail-spacer { flex: 1; }
.me-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: #d9e6de; color: #2f5a43; font-weight: 700; font-size: 14px;
}

/* Chat list extras */
.filters { align-items: center; flex-wrap: wrap; }
.owner-filter { margin-left: auto; border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; font-size: 13px; background: var(--panel); }
.chat-main { min-width: 0; }
.chat-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag, .owner-chip { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.at { background: var(--info-soft); color: var(--info); }
.tag.help { background: var(--note); color: #7a5c00; }
.owner-chip { background: #eeebe5; color: var(--muted); font-weight: 500; }

/* Thread header: owner, helpers, actions */
.thread-head { flex-wrap: wrap; row-gap: 8px; }
.thread-who { min-width: 0; }
.thread-team { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.owner-pick { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.owner-pick select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; background: var(--panel); font-weight: 600; }
.helpers { display: flex; gap: 4px; }
.helper { background: var(--note); color: #7a5c00; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 13px; font-weight: 600; }
.ghost:hover { background: var(--bg); }
#done-btn { border-color: var(--accent); color: var(--accent); }

/* Messages: author, actions, quotes */
.bubble .foot { align-items: center; }
.bubble .by { font-weight: 600; color: #3f6b53; margin-right: 2px; }
.bubble .act {
  border: 0; background: none; padding: 0 4px; font-size: 11px; color: var(--accent);
  opacity: 0; transition: opacity .12s;
}
.bubble:hover .act, .bubble:focus-within .act { opacity: 1; }
.bubble .act + .act { margin-right: auto; }
.quoted {
  border-left: 3px solid var(--accent); background: rgba(0,0,0,.04);
  border-radius: 6px; padding: 4px 8px; margin-bottom: 5px; font-size: 13px; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.quoted b { display: block; font-size: 12px; color: var(--accent); }
.flash { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Internal notes and events */
.bubble.note {
  align-self: center; width: min(620px, 92%); max-width: none;
  background: var(--note); border: 1px dashed var(--note-line); box-shadow: none;
}
.note-head { font-size: 12px; font-weight: 600; color: #7a5c00; margin-bottom: 3px; }
.bubble.note .quoted { border-left-color: #c9a227; }
.bubble.note .quoted b { color: #7a5c00; }
.bubble.note .act { color: #7a5c00; margin-left: auto; }
.mention { background: var(--info-soft); color: var(--info); font-weight: 600; border-radius: 4px; padding: 0 3px; }
.mention.me { background: var(--info); color: #fff; }
.event { align-self: center; font-size: 12px; color: var(--muted); padding: 4px 10px; margin: 4px 0; }

/* Composer: reply vs note */
.composer { flex-direction: column; align-items: stretch; gap: 8px; }
.composer-tabs { display: flex; gap: 4px; align-items: center; }
.mode { border: 0; background: none; padding: 4px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.mode.active { background: var(--accent-soft); color: var(--accent); }
.composer.noting .mode.active { background: var(--note); color: #7a5c00; }
.mode-hint { margin-left: auto; font-size: 12px; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.text-wrap { flex: 1; position: relative; display: flex; }
.composer.noting textarea { background: var(--note); border-color: var(--note-line); }
.composer.noting button[type=submit] { background: #a07c00; }
.quote-bar {
  display: flex; align-items: flex-start; gap: 8px;
  border-left: 3px solid var(--accent); background: var(--bg); border-radius: 6px; padding: 6px 10px; font-size: 13px;
}
.quote-bar > div { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-bar b { margin-right: 6px; color: var(--accent); }
.quote-bar button { border: 0; background: none; font-size: 18px; line-height: 1; color: var(--muted); }
.mention-pick {
  position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 5;
  list-style: none; margin: 0; padding: 4px; min-width: 220px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.mention-pick li { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.mention-pick li.sel, .mention-pick li:hover { background: var(--accent-soft); }

/* Account and team dialogs */
.menu-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.menu-list button { text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 10px 12px; font-weight: 500; }
.menu-list button:hover { background: var(--bg); }
.menu-list .danger { color: var(--warn); }
.dialog-body h4 { margin: 10px 0 0; font-size: 14px; }
#team-dialog { width: min(520px, calc(100vw - 32px)); }
.team-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.team-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.team-add { display: flex; gap: 8px; }
.team-add input { flex: 1; min-width: 0; }
.team-add button { background: var(--accent); color: #fff; border: 0; border-radius: var(--radius); padding: 0 16px; font-weight: 600; }
.new-pass { background: var(--accent-soft); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; line-height: 1.5; }
.secondary.small { padding: 5px 10px; font-size: 13px; background: transparent; border: 1px solid var(--line); border-radius: 8px; font-weight: 500; }

@media (max-width: 760px) {
  .bubble .act { opacity: 1; }
  .mode-hint { display: none; }
}
.bubble .gone { font-size: 13px; color: var(--muted); font-style: italic; padding: 2px 0 4px; }

/* Follow-up flag: we promised the customer something and went quiet */
:root { --follow: #a34b00; --follow-soft: #fdebd9; }
.tag.follow { background: var(--follow-soft); color: var(--follow); }
.filter .count { background: var(--follow); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; margin-left: 2px; }
.ghost.followed { border-color: var(--follow); color: var(--follow); }

/* ---------- Labels ---------- */
.lab { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.lab-green  { background: #dcf2e3; color: #1d6b41; }
.lab-red    { background: #fde2df; color: #a32a1f; }
.lab-blue   { background: #e0eafb; color: #2456a3; }
.lab-orange { background: #fdeacc; color: #8f4f00; }
.lab-purple { background: #ece3fa; color: #5d34a3; }
.lab-brown  { background: #efe4da; color: #6b4426; }
.lab-teal   { background: #d9f1ef; color: #1c6660; }
.lab-grey   { background: #ebe9e4; color: #55594f; }
.label-wrap { position: relative; display: flex; align-items: center; gap: 6px; }
.chat-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.label-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 10;
  list-style: none; margin: 0; padding: 4px; min-width: 200px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.label-menu li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.label-menu li:hover { background: var(--bg); }
.label-menu .check { width: 14px; color: var(--accent); font-weight: 700; }
#label-filter { margin-left: auto; }
#label-filter + .owner-filter { margin-left: 0; }

/* ---------- Attachments ---------- */
.attach-btn { border: 0; background: none; font-size: 20px; padding: 6px 4px; line-height: 1; align-self: center; }
.attach-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.attach-bar > div { flex: 1; min-width: 0; }
.attach-bar b { overflow-wrap: anywhere; }
.attach-bar img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.attach-bar button { border: 0; background: none; font-size: 20px; color: var(--muted); }
.thread.dropping .messages { outline: 3px dashed var(--accent); outline-offset: -10px; }

/* ---------- Quick replies ---------- */
.slash-pick { min-width: 340px; max-width: min(520px, 90vw); }
.slash-pick li { flex-direction: column; gap: 1px; align-items: flex-start; }
.slash-pick .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.slash-pick .empty-pick { cursor: default; }
#quick-dialog { width: min(620px, calc(100vw - 32px)); }
.quick-list { list-style: none; margin: 0; padding: 0; max-height: 40vh; overflow-y: auto; border-top: 1px solid var(--line); }
.quick-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.quick-main { flex: 1; min-width: 0; }
.quick-text { white-space: pre-wrap; font-size: 13px; color: var(--muted); margin-top: 3px; max-height: 5.4em; overflow: hidden; }
.quick-acts { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.dialog-body textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); resize: vertical; }
.dialog-body h3 .muted { font-size: 14px; font-weight: 500; }

.qr-hint { font-size: 12px; text-align: center; margin: 0; }

.account-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.relink-btn { flex-shrink: 0; margin-top: 2px; }
.relink-btn.urgent { border-color: var(--warn); color: #fff; background: var(--warn); }

/* ---------- AI buttons ---------- */
.ai-btn { color: #5d34a3; border-color: #d9cdf3; white-space: nowrap; }
.ai-btn:disabled { opacity: .6; cursor: progress; }
.composer-row .ai-btn { align-self: center; }
.rail-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: #34443b; font-size: 18px; }
.check-row { display: flex !important; align-items: center; gap: 8px; color: var(--text) !important; margin-top: 8px; }
.ai-cost { font-size: 12px; background: var(--bg); border-radius: 8px; padding: 8px 10px; }
#ai-dialog { width: min(560px, calc(100vw - 32px)); }
#ai-dialog select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }

/* ---------- Reports ---------- */
:root { --series-in: #2a78d6; --series-out: #eb6834; }
#reports-dialog { width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.reports { gap: 14px; }
.reports-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.reports-head h3 { margin-right: auto; }
.range { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 10px; }
.range button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.range button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile-value { font-size: 26px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12px; color: var(--muted); line-height: 1.35; }
#report-body h4 { margin: 20px 0 8px; font-size: 14px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw-in { background: var(--series-in); }
.sw-out { background: var(--series-out); }
.day-chart { width: 100%; height: auto; display: block; }
.day-chart .b-in { fill: var(--series-in); }
.day-chart .b-out { fill: var(--series-out); }
.day-chart .grid { stroke: #ebe8e2; stroke-width: 1; }
.day-chart .axis { fill: var(--muted); font-size: 11px; }
.day-chart .hit { fill: transparent; }
.day-chart .hit:hover { fill: rgba(0,0,0,.04); }
.chart-tip { position: fixed; z-index: 100; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.12); pointer-events: none; line-height: 1.6; }
.day-table summary { font-size: 13px; color: var(--accent); cursor: pointer; margin-top: 6px; }
.day-table table, .report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.day-table th, .day-table td, .report-table th, .report-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.report-table th, .day-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.report-table td:nth-child(n+2):not(:nth-child(3)) { font-variant-numeric: tabular-nums; }
.report-table.promises tbody tr { cursor: pointer; }
.report-table.promises tbody tr:hover { background: var(--bg); }
@media (max-width: 760px) { .tile-value { font-size: 22px; } }
.check-row input[type=checkbox] { width: auto; margin: 0; }

/* ---------- Version, team AI switch ---------- */
.version { font-size: 12px; }
.team-acts { display: flex; gap: 6px; flex-shrink: 0; }
.ai-toggle { color: var(--muted); }
.ai-toggle.on { background: #ece3fa; border-color: #d9cdf3; color: #5d34a3; font-weight: 600; }

/* ---------- Phone ---------- */
.composer textarea { min-width: 0; width: 100%; }
@media (max-width: 760px) {
  .app { height: 100dvh; grid-template-columns: 56px minmax(0, 1fr); }
  /* Reading a chat: the chat gets the whole screen. */
  .app.reading { grid-template-columns: minmax(0, 1fr); }
  .app.reading .numbers { display: none; }

  .chats-head { padding: 12px 12px 8px; }
  .search-wrap { padding: 0 12px 8px; }
  .search-wrap input { font-size: 16px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; padding: 0 12px 8px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filter, .owner-filter { flex-shrink: 0; }
  .chat { padding: 10px 12px; }

  .thread-head { padding: 8px 10px; gap: 8px; column-gap: 8px; }
  .thread-head .avatar { width: 34px; height: 34px; font-size: 13px; }
  .thread-who { flex: 1; }
  .thread-who h2 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* Owner, helpers and actions sit on one row that scrolls sideways. */
  .thread-team { margin-left: 0; width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 2px; scrollbar-width: none; }
  .thread-team::-webkit-scrollbar { display: none; }
  .thread-team > * { flex-shrink: 0; }
  .thread-team .ghost { padding: 5px 9px; }
  .owner-pick { font-size: 13px; }
  .label-menu { position: fixed; top: 110px; left: 12px; right: 12px; min-width: 0; max-height: 50vh; overflow-y: auto; }

  .composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
  .composer-tabs .mode { padding: 4px 8px; }
  .composer-row { gap: 6px; }
  .composer textarea { font-size: 16px; padding: 9px 10px; }
  .composer button[type=submit] { padding: 10px 14px; }
  .composer-row .ai-btn { padding: 5px 8px; }
  .slash-pick { min-width: 0; width: calc(100vw - 24px); }
  .mention-pick { min-width: 0; max-width: calc(100vw - 24px); }

  .team-list li { flex-wrap: wrap; }
}

/* ---------- Version ---------- */
.rail-version { font-size: 10px; color: #8fa197; letter-spacing: .02em; }
.login-version { text-align: center; font-size: 12px; margin-top: 6px; }
.update-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: #2b2f2d; color: #fff; font-size: 14px;
}
.update-bar button { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 6px 14px; font-weight: 600; }
