:root {
  --brand: #2f5bea;
  --brand-2: #1f45c7;
  --brand-soft: #eef2fe;
  --bg: #f4f4f1;
  --panel: #ffffff;
  --ink: #16171b;
  --ink-2: #3d3f47;
  --muted: #6b6d76;
  --line: #e3e3de;
  --line-2: #efefeb;
  --ok: #1f9d55;
  --warn: #e8772e;
  --danger: #c93a2e;
  --rail: #141518;
  --radius: 12px;
  font-family: Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
#app { height: var(--app-h, 100%); }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }

/* ── controls ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: 13.5px; white-space: nowrap;
  color: var(--ink); text-decoration: none;
}
.btn:hover { background: #fafbfd; border-color: #d6d9e4; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn:disabled { opacity: .5; cursor: default; }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input { border-color: #dcdcd6; }
select.input { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6d76' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; padding-right: 32px; }
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.err { color: var(--danger); font-size: 13px; margin: 8px 0 0; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2); }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.bad { background: #fee2e2; color: #991b1b; }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: #0f1020; color: #e3e5f5;
  border-radius: 10px; padding: 14px 16px; white-space: pre-wrap; word-break: break-all; position: relative;
}
.code .copy { position: absolute; top: 8px; right: 8px; }
kbd, code.inline { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--line-2); padding: 1px 5px; border-radius: 5px; }

.av {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; position: relative;
  font-weight: 700; font-size: 13px; color: #1f45c7; background: #d8e0fb;
}
.av.xl { width: 48px; height: 48px; font-size: 17px; }
.av.md { width: 40px; height: 40px; font-size: 14px; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.sm { width: 28px; height: 28px; font-size: 11px; }
.av.lg { width: 56px; height: 56px; font-size: 20px; }
.av-wrap { position: relative; flex: none; }
.av-wrap .on { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--ok); border: 2px solid #fff; }

/* ── auth pages ── */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% -10%, #e5e7ff, transparent), var(--bg); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; margin-bottom: 22px; }
.logo i { width: 32px; height: 32px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; color: #fff; font-style: normal; }
.auth .lang-switch { position: fixed; top: 16px; right: 16px; }

/* ── sign-in / invite ── */
.auth2 { min-height: 100%; display: grid; grid-template-columns: minmax(360px, 44%) 1fr; background: var(--bg); }
.auth-brand { background: var(--rail); color: #f1f1f3; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; }
.auth-brand::after { content: ''; position: absolute; right: -160px; bottom: -160px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(47,91,234,.35), transparent 70%); pointer-events: none; }
.brand-mark { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-copy h2 { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -.02em; margin: 0 0 28px; max-width: 420px; }
.brand-copy ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; max-width: 420px; }
.brand-copy li { display: flex; gap: 14px; align-items: flex-start; }
.brand-copy .fi { width: 36px; height: 36px; border-radius: 10px; background: #26282e; color: #c9d4ff; display: grid; place-items: center; flex: none; }
.brand-copy li b { display: block; font-weight: 600; margin-bottom: 2px; }
.brand-copy li span span { color: #a3a5ae; font-size: 13.5px; }
.brand-foot { font-size: 12.5px; color: #7d7f89; }
.auth-main { position: relative; display: grid; place-items: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { font-size: 26px; font-weight: 600; letter-spacing: -.015em; margin: 0 0 6px; }
.auth-box .lead { color: #5d5f68; margin: 0 0 26px; }
.auth-box .sm-only { display: none; margin-bottom: 28px; }
.auth-main .lang-switch { position: absolute; top: 20px; right: 20px; }
.input.lg { height: 44px; }
.btn.block { width: 100%; height: 44px; font-size: 14px; }
@media (max-width: 860px) {
  .auth2 { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-box .sm-only { display: inline-flex; }
}

/* ── shell ── */
.shell { display: flex; height: 100%; }
.rail {
  width: 72px; flex: none; background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 16px 0; gap: 6px;
}
.rail .ws-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; color: #fff; font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.rail a, .rail button.nav {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #9a9ca6; position: relative; border: 0; background: none;
}
.rail a:hover, .rail button.nav:hover { background: #22242a; color: #fff; }
.rail a.active { background: #2a2c33; color: #fff; }
.rail .spacer { flex: 1; }
.rail .badge { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--warn); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.rail .me { border: 0; background: none; padding: 0; margin-top: 6px; }
.main { flex: 1; min-width: 0; display: flex; }

.menu {
  position: fixed; z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(20, 22, 50, .15);
  padding: 6px; min-width: 220px; max-height: 70vh; overflow: auto;
}
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; text-decoration: none; color: var(--ink); }
.menu button:hover, .menu a:hover { background: var(--line-2); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 0; }
.menu .label { font-size: 11.5px; color: var(--muted); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.menu .sq { width: 24px; height: 24px; border-radius: 7px; color: #fff; font-weight: 800; font-size: 11px; display: grid; place-items: center; flex: none; }

/* ── inbox ── */
.list-col { width: 348px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 20px 16px 12px; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 12px; }
.list-head h2 { font-size: 20px; font-weight: 600; }
.tabs { display: flex; gap: 2px; background: #f1f1ee; padding: 3px; border-radius: 10px; }
.tabs button { flex: 1; border: 0; background: none; height: 30px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: #5d5f68; display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.tabs button .n { font-size: 11px; font-weight: 500; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20,21,24,.12); }
.search { position: relative; }
.search input { padding-left: 32px; height: 34px; background: #fafaf8; border-color: var(--line); font-size: 13px; }
.search svg { position: absolute; left: 10px; top: 9px; color: #8a8c95; }
.conv-list { flex: 1; overflow-y: auto; }
.conv {
  display: flex; gap: 12px; padding: 13px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid #f1f1ee; cursor: pointer;
}
.conv:hover { background: #fafaf8; }
.conv.active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.conv .c-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.conv .c-top { display: flex; align-items: baseline; gap: 8px; }
.conv .c-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .c-cc { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.conv .c-time { font-size: 12px; color: var(--muted); flex: none; margin-left: auto; }
.conv .c-prev { font-size: 13px; color: #5d5f68; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .c-name { font-weight: 700; }
.conv.unread .c-prev { color: var(--ink); font-weight: 500; }
.conv .c-count { min-width: 20px; height: 20px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.conv .c-bottom { display: flex; align-items: center; gap: 8px; }
.conv .c-chip { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 10px; background: #f1f1ee; font-size: 11.5px; font-weight: 500; color: #4a4c55; }
.conv .typing-now { color: var(--brand); font-style: italic; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 8px; }
.notice { margin: 10px 16px 0; padding: 10px 12px; border-radius: 10px; background: #fffbeb; color: #92400e; font-size: 12.5px; display: flex; align-items: center; gap: 8px; }

.thread-col { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.thread-head { height: 68px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.thread-head .t-name { font-weight: 600; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head .t-sub { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head .t-sub .d { width: 7px; height: 7px; border-radius: 50%; background: #b9bbc3; flex: none; }
.thread-head .t-sub .d.on { background: var(--ok); }
.thread-head .back { display: none; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #2a2c33; }
.assign-btn .av { width: 22px; height: 22px; font-size: 10px; }
.thread-body { flex: 1; overflow-y: auto; padding: 20px 32px 8px; }
.day { display: table; margin: 16px auto 10px; color: var(--muted); font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 10px; background: #ebebe6; }
.form-note { display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.msg { display: flex; gap: 10px; align-items: flex-end; margin-top: 2px; }
.msg.gap { margin-top: 14px; }
.msg.agent { flex-direction: row-reverse; }
.msg .spacer { width: 28px; flex: none; }
.msg .m-col { display: flex; flex-direction: column; max-width: min(620px, 72%); min-width: 0; }
.msg.agent .m-col { align-items: flex-end; }
.msg .m-name { font-size: 11.5px; color: var(--muted); margin: 0 4px 3px; }
.bubble { padding: 10px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.msg.agent .bubble { background: var(--brand); border-color: var(--brand); color: #fff; }
.msg.agent .bubble a { color: #fff; }
.msg.visitor .bubble { border-bottom-left-radius: 6px; }
.msg.agent .bubble { border-bottom-right-radius: 6px; }
.bubble.img { padding: 3px; background: transparent !important; border: 0; }
.bubble.img img { display: block; max-width: 260px; max-height: 300px; border-radius: 12px; cursor: zoom-in; }
.bubble.vid { padding: 3px; background: transparent !important; border: 0; }
.bubble.vid video { display: block; width: 260px; max-width: 100%; max-height: 320px; border-radius: 12px; background: #000; }
.bubble.pending { opacity: .6; }
.bubble.failed { opacity: .8; box-shadow: 0 0 0 1px var(--danger); }
.m-fail { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 4px 4px 0; font-size: 12px; color: var(--danger); }
.m-fail button { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: inherit; text-decoration: underline; cursor: pointer; }
.m-fail button:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; border-radius: 3px; }
.m-meta { font-size: 11.5px; color: var(--muted); margin: 4px 4px 0; }
.ghost-typing .bubble { background: transparent; border: 1.5px dashed #c7cbe0; color: var(--muted); font-style: italic; }

.composer-wrap { padding: 0 20px 20px; flex: none; }
.composer { background: var(--panel); border: 1px solid #dcdcd6; border-radius: 14px; box-shadow: 0 1px 2px rgba(20,21,24,.04); transition: border-color .15s ease, box-shadow .15s ease; }
.composer:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.composer #attachBox { padding: 10px 12px 0; }
.composer textarea { display: block; width: 100%; border: 0; outline: none; resize: none; min-height: 48px; max-height: 200px; padding: 14px 16px 6px; background: transparent; }
.composer .bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px 10px; }
.composer .hint-keys { font-size: 12px; color: var(--muted); }
.composer .who-typing { font-size: 12px; color: var(--brand); font-style: italic; }
.attach-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 10px; background: var(--line-2); font-size: 12px; margin-bottom: 6px; }
.attach-chip img { width: 36px; height: 36px; border-radius: 7px; object-fit: cover; }
.attach-chip button { border: 0; background: none; font-size: 16px; color: var(--muted); }
.closed-bar { margin: 0 20px 10px; padding: 10px 14px; border-radius: 10px; background: #ebebe6; text-align: center; font-size: 13px; color: #4a4c55; }

.side-col { width: 320px; flex: none; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }
.side-sec { padding: 18px 22px; border-bottom: 1px solid var(--line-2); }
.side-sec h4 { margin: 0 0 12px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.side-sec textarea.input { background: #fafaf8; font-size: 13px; resize: none; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; min-width: 0; }
.inline-edit { border: 1px solid transparent; border-radius: 8px; padding: 4px 6px; margin: -5px -7px; width: calc(100% + 14px); background: transparent; outline: none; }
.inline-edit:hover { border-color: var(--line); }
.inline-edit:focus { border-color: var(--brand); background: #fff; }
.side-profile { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.side-profile .nm { font-weight: 600; font-size: 16px; }

.placeholder { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 24px; }

/* ── pages (settings, platform, profile) ── */
.page { flex: 1; overflow-y: auto; }
.page-inner { max-width: 1200px; margin: 0 auto; padding: 32px 24px 60px; }
.page-inner.wide { max-width: 1100px; }
.page h1 { font-size: 26px; font-weight: 600; letter-spacing: -.015em; margin-bottom: 6px; }
.page .sub { color: var(--muted); margin: 0 0 24px; }
.settings-layout { display: flex; gap: 28px; align-items: flex-start; }
.settings-nav { width: 220px; flex: none; position: sticky; top: 20px; display: flex; flex-direction: column; gap: 18px; }
.settings-nav .grp { display: flex; flex-direction: column; gap: 2px; }
.settings-nav .glabel { padding: 0 10px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.settings-nav a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.settings-nav a:hover { background: #ebebe6; }
.settings-nav a.on { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }

/* settings sections: title + explanation on the left, controls on the right */
.sec { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 32px; padding: 24px 0; border-top: 1px solid var(--line); }
.sec:first-of-type { border-top: 0; padding-top: 4px; }
.sec h2 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.sec .sdesc { margin: 0; font-size: 13px; color: #5d5f68; }
.bm-logo { height: 34px; max-width: 160px; object-fit: contain; border-radius: 8px; }
.rail .ws-btn { display: grid; place-items: center; overflow: hidden; padding: 0; }
.rail .ws-btn img { width: 100%; height: 100%; object-fit: contain; }
.rail .brand-tile { background: transparent; color: #fff; }
.blocked { max-width: 460px; }
.blocked .b-ic { width: 52px; height: 52px; border-radius: 16px; background: #fbe8da; color: #a4501a; display: grid; place-items: center; margin: 0 auto 16px; }
.blocked h2 { font-size: 20px; color: var(--ink); margin-bottom: 8px; }
.blocked p { margin: 0 0 12px; }
.warn-notice { background: #fbe8da; color: #8a3f10; }
.plan-name { font-size: 18px; font-weight: 600; }
.usage b { font-weight: 600; font-size: 15px; }
.meter { height: 8px; border-radius: 4px; background: #ebebe6; margin-top: 8px; max-width: 420px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.meter span.full { background: var(--warn); }
.feat-list { display: flex; flex-wrap: wrap; gap: 8px; }
.feat { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 15px; background: #ebebe6; color: #6b6d76; font-size: 13px; }
.feat.on { background: #e3f4ea; color: #17693f; font-weight: 500; }
.ptabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.ptabs a { padding: 10px 14px; color: #5d5f68; text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ptabs a:hover { color: var(--ink); }
.ptabs a.on { color: var(--ink); border-bottom-color: var(--brand); }
.st-pill.expiring { background: #fdf0c7; color: #8a6200; }
.st-pill.expiring .d { background: #d9a400; }
.st-pill.expired { background: #f9dedb; color: #9b2c22; }
.st-pill.expired .d { background: var(--danger); }
.modal.wide { max-width: 620px; max-height: 90vh; overflow-y: auto; }
.modal .mh { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.feat-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.plan-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.plan-card .plan-fields { margin-top: 14px; }
.plan-card .px-input .input { width: 100%; }
.plan-card .px-input { display: flex; }
.plan-add { border: 1.5px dashed #c9cbd4; border-radius: 14px; background: transparent; min-height: 160px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; color: #4a4c55; }
.plan-add:hover { border-color: var(--brand); color: var(--brand); }
.page-top { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; }
.stat .s { font-size: 12.5px; color: #5d5f68; margin-top: 2px; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; justify-content: space-between; }
.toolbar .seg button { height: 30px; padding: 0 12px; }
.ws-tile { width: 36px; height: 36px; border-radius: 10px; color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; flex: none; }
.mono { font-family: "Geist Mono", ui-monospace, monospace; }
.st-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.st-pill .d { width: 7px; height: 7px; border-radius: 50%; }
.st-pill.active { background: #e3f4ea; color: #17693f; }
.st-pill.active .d { background: var(--ok); }
.st-pill.suspended { background: #fbe8da; color: #8a3f10; }
.st-pill.suspended .d { background: var(--warn); }
.modal .field { margin-bottom: 14px; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .page-top { flex-wrap: wrap; align-items: flex-start; } }
.phead { margin: 0 0 18px; }
.phead h2 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.phead p { margin: 0; color: #5d5f68; max-width: 640px; }
.sbody { min-width: 0; }
.sec.wide { grid-template-columns: 1fr; gap: 14px; }
.table th { white-space: nowrap; }
.flabel { display: block; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.px-input { position: relative; display: inline-flex; align-items: center; }
.px-input .input { width: 160px; padding-right: 48px; }
.px-input span { position: absolute; right: 12px; font-size: 12.5px; color: var(--muted); }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { height: 34px; padding: 0 14px; border-radius: 9px; display: flex; align-items: center; font-size: 13px; font-weight: 600; color: #4a4c55; cursor: pointer; }
.seg-opt input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20,21,24,.14); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.range-cell { display: flex; align-items: center; gap: 8px; }
.range-cell input { flex: 1; min-width: 0; }
.range-cell output { font-size: 12.5px; color: var(--muted); width: 38px; text-align: right; }
.table-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.table-card .table th, .table-card .table td { padding-left: 16px; padding-right: 16px; }
.swatch { padding: 0; }
.settings-layout:has(.pv-col) .sec { grid-template-columns: 1fr; gap: 12px; }
.summary { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 20px; }
.summary .big-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.summary .big-dot.on { background: var(--ok); box-shadow: 0 0 0 4px #dff3e8; }
.summary .big-dot.off { background: var(--warn); box-shadow: 0 0 0 4px #fbe8da; }
.summary .mono { font-family: "Geist Mono", ui-monospace, monospace; font-size: 12.5px; color: #4a4c55; padding: 4px 10px; border-radius: 8px; background: #f1f1ee; white-space: nowrap; }
.seg { display: inline-flex; padding: 4px; gap: 4px; background: #ebebe6; border-radius: 12px; flex-wrap: wrap; }
.seg button { height: 36px; padding: 0 16px; border: 0; border-radius: 9px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; background: transparent; color: #4a4c55; }
.seg button[aria-checked=true] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20,21,24,.14); }
.seg .d { width: 8px; height: 8px; border-radius: 50%; }
.opts { display: grid; gap: 10px; }
.opts.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); text-align: left; transition: border-color .15s ease, background .15s ease; }
.opt:hover { border-color: #c9cbd4; }
.opt[aria-checked=true] { border-color: var(--brand); background: #f5f7ff; }
.opt .ring { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #c3c5cc; display: grid; place-items: center; flex: none; margin-top: 1px; }
.opt[aria-checked=true] .ring { border-color: var(--brand); }
.opt[aria-checked=true] .ring::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.opt .ot { font-weight: 600; display: block; }
.opt .od { font-size: 13px; color: #5d5f68; display: block; margin-top: 2px; }
.opts.cols3 .opt { flex-direction: column; gap: 6px; }
.opts.cols3 .opt .top { display: flex; width: 100%; justify-content: space-between; align-items: center; }
.opts.dim { opacity: .5; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 11px; border: 0; padding: 0; flex: none; background: #cfd1d7; transition: background .15s ease; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s ease; }
.switch[aria-checked=true] { background: var(--brand); }
.switch[aria-checked=true]::after { left: 19px; }
.htable { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.hrow2 { display: flex; align-items: center; gap: 14px; padding: 0 16px; min-height: 54px; border-top: 1px solid #f1f1ee; flex-wrap: wrap; }
.hrow2:first-child { border-top: 0; }
.hrow2 .dname { width: 96px; font-weight: 500; }
.hrow2 input[type=time] { height: 34px; width: 124px; padding: 0 10px; border: 1px solid #dcdcd6; border-radius: 8px; background: #fff; }
.hrow2 .allday { font-size: 12.5px; color: #17693f; font-weight: 500; }
.savebar { position: sticky; bottom: 16px; z-index: 5; margin-top: 24px; padding: 12px 14px 12px 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(20,21,24,.08); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.savebar > .grow { min-width: 150px; }
.savebar .d { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.savebar.clean .d { background: #b9bbc3; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; margin-bottom: 18px; }
.card h3 { font-size: 16px; margin-bottom: 4px; }
.card > p.muted { margin: 0 0 18px; }
.card .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; align-items: center; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; position: relative; } /* keeps absolutely positioned bits (screen-reader labels) inside the scroll box */
.color-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
input[type=color] { width: 44px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1c1d2b; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13.5px; z-index: 100; box-shadow: 0 8px 30px rgba(0,0,0,.25); animation: up .2s ease;
}
.toast.bad { background: var(--danger); }
@keyframes up { from { opacity: 0; transform: translate(-50%, 8px); } }
.modal-bg { position: fixed; inset: 0; background: rgba(15, 16, 30, .45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 460px; padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
/* a dialog taller than the screen (a long team list) scrolls; its buttons wrap instead of running off */
.modal { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.modal .row { flex-wrap: wrap; }
.modal h3 { font-size: 18px; margin-bottom: 8px; }

/* ── widget settings editors + live preview ── */
.page-inner.xwide { max-width: 1480px; }
.pv-col { width: 420px; flex: none; position: sticky; top: 20px; }
.pv-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pv-head .tabs { margin: 0; flex: 1; }
.pv-stage {
  height: 700px; border-radius: 16px; border: 1px solid var(--line); overflow: hidden;
  background: repeating-linear-gradient(45deg, #eef0f5 0 12px, #e8eaf1 12px 24px);
}
.pv-stage iframe { width: 100%; height: 100%; border: 0; display: block; }
.logo-box, .img-box { display: grid; place-items: center; min-width: 64px; height: 44px; padding: 4px 8px; border: 1px dashed var(--line); border-radius: 10px; background: #fafbfd; }
.logo-box img { max-height: 34px; max-width: 160px; }
.img-box { height: 90px; min-width: 120px; padding: 4px; }
.img-box img { max-height: 80px; max-width: 200px; border-radius: 8px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--line); background: #fff; font-size: 12.5px; font-weight: 600; }
.status-pill .d { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.status-pill.on .d { background: var(--ok); box-shadow: 0 0 0 3px #dcfce7; }
.status-pill.off .d { background: var(--warn); }
.my-dot { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--ok); border: 2px solid var(--rail); }
.my-dot.away { background: var(--warn); }
.dot-ok, .dot-away { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.dot-away { background: var(--warn); }
.hours { display: grid; gap: 6px; }
.geo-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; align-items: center; }
.geo-grid .px { position: relative; }
.geo-grid .px .input { padding-right: 30px; height: 34px; }
.geo-grid .px span { position: absolute; right: 10px; top: 8px; font-size: 12px; color: var(--muted); }
input[type=range] { accent-color: var(--brand); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tpl { border: 2px solid var(--line); border-radius: 12px; padding: 4px 4px 8px; background: #fff; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; text-align: center; }
.tpl img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; }
.tpl:hover { border-color: #c7cbe0; }
.tpl.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.btn-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.btn-row .input { width: auto; flex: 1; min-width: 120px; }
.btn-row select.input { flex: 0 0 auto; }
.fld-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #fcfcfe; }
@media (max-width: 1280px) {
  .settings-layout:has(.pv-col) { flex-wrap: wrap; }
  /* 220px menu + 28px gap: with less room left, the form wrapped under the sticky menu, which then covered it */
  .settings-layout:has(.pv-col) > .grow { flex-basis: calc(100% - 248px); }
  .pv-col { position: static; width: 100%; max-width: 440px; margin-left: 248px; }
}
@media (max-width: 860px) { .pv-col { margin-left: 0; } .settings-layout:has(.pv-col) > .grow { flex-basis: 100%; } }

/* ── responsive ── */
@media (max-width: 1280px) {
  .side-col { position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; box-shadow: -10px 0 40px rgba(0,0,0,.12); }
  .side-col:not(.show) { display: none; }
}
@media (min-width: 1281px) { .info-toggle { display: none !important; } }
@media (max-width: 860px) {
  .list-col { width: 100%; border-right: 0; }
  .has-thread .list-col { display: none; }
  .main:not(.has-thread) .thread-col { display: none; }
  .thread-head .back { display: inline-flex; }
  .thread-body { padding: 16px 12px 8px; }
  .settings-layout { flex-direction: column; align-items: stretch; }
  .settings-layout > * { min-width: 0; max-width: 100%; } /* follow the screen, not the widest row inside */
  .settings-nav { width: 100%; position: static; flex-direction: row; gap: 4px; overflow-x: auto; }
  .settings-nav .grp { flex-direction: row; }
  .settings-nav .glabel { display: none; }
  .settings-nav a { white-space: nowrap; }
  .sec { grid-template-columns: 1fr; gap: 14px; }
  .opts.cols3 { grid-template-columns: 1fr; }
  .thread-head { padding: 0 8px 0 4px; gap: 8px; }
  .thread-head .assign-btn .nm, .hide-sm, .thread-head .info-toggle { display: none !important; }
  .thread-head .assign-btn { padding: 0 8px; }
  .thread-head #statusBtn .lbl { display: none; }
  .composer textarea { font-size: 16px; } /* no iOS focus zoom */
  .composer-wrap { padding: 0 10px 10px; }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .shell { flex-direction: column-reverse; }
  .rail { width: 100%; height: 56px; flex-direction: row; padding: 0 8px; justify-content: space-around; }
  .rail .ws-btn { margin: 0; width: 36px; height: 36px; }
  .rail .spacer { display: none; }
  .rail .me { margin: 0; }
  .main { min-height: 0; }
  .page-inner { padding: 20px 16px 40px; }
  .card { padding: 18px 16px; }
}

/* ── motion ── */
:root { --ease-out: cubic-bezier(.16, 1, .3, 1); }
.menu { animation: pop-in .18s var(--ease-out) both; transform-origin: top left; }
.modal-bg { animation: fade-in .2s ease both; }
.modal { animation: pop-in .28s var(--ease-out) both; }
.side-col.show { animation: slide-in .32s var(--ease-out) both; }
.conv { transition: background .15s ease; }
.card, .fld-card, .btn-row, .notice { animation: fade-up .3s var(--ease-out) both; }
.btn { transition: background .15s ease, border-color .15s ease, transform .1s ease, box-shadow .15s ease; }
.btn:active:not(:disabled) { transform: scale(.97); }
.tpl { transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.tpl:hover { transform: translateY(-2px); }
.rail a, .rail button.nav { transition: background .15s ease, color .15s ease; }
.msg.enter .bubble { animation: pop-left .5s cubic-bezier(.34, 1.56, .64, 1) calc(.04s - var(--age, 0ms)) both; transform-origin: bottom left; }
.msg.agent.enter .bubble { animation-name: pop-right; animation-delay: calc(.08s - var(--age, 0ms)); transform-origin: bottom right; }
.msg.enter .m-meta, .msg.enter .m-name { animation: fade-in .3s ease calc(.3s - var(--age, 0ms)) both; }
@keyframes pop-right { 0% { opacity: 0; transform: translate(28px, 8px) scale(.55); } 55% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes pop-left { 0% { opacity: 0; transform: translate(-20px, 8px) scale(.6); } 55% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ── composer: reply / internal note ── */
.composer-wrap { position: relative; }
.cmp-tabs { display: flex; gap: 2px; padding: 8px 10px 0; }
.cmp-tabs button { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.cmp-tabs button:hover { color: var(--ink); background: var(--line-2); }
.cmp-tabs button.on { color: var(--ink); background: var(--line-2); font-weight: 600; }
.composer textarea { padding-top: 8px; }
.composer.note { background: #fffaeb; border-color: #f0d68a; }
.composer.note:focus-within { border-color: #d9a91c; box-shadow: 0 0 0 3px rgba(233, 180, 30, .18); }
.composer.note .cmp-tabs button.on { background: #fcecb6; color: #7a5300; }
.composer.note #sendBtn { background: #b7791f; border-color: #b7791f; }

/* internal notes in the thread */
.msg.note .bubble { background: #fff4cf; border-color: #f0d68a; color: var(--ink); border-bottom-right-radius: 6px; }
.msg.note .bubble a { color: #7a5300; }
.m-name.note-label { display: inline-flex; align-items: center; gap: 4px; color: #8a5d00; font-weight: 600; }

/* suggested replies */
.suggest { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.suggest .sg-l { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 2px; }
.suggest .sg-l svg { width: 14px; height: 14px; color: var(--brand); }
.sg-chip { height: 28px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; font-weight: 500; color: var(--ink-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: border-color .15s ease, color .15s ease, background .15s ease; }
.sg-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* "/" picker */
.canned-pick { position: absolute; left: 20px; right: 20px; bottom: calc(100% - 12px); z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 44px rgba(20, 22, 50, .16); overflow: hidden; animation: pop-in .16s var(--ease-out) both; transform-origin: bottom left; }
.canned-pick .pk-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px 6px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.canned-pick .pk-head .small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.canned-pick .pk-list { max-height: 300px; overflow-y: auto; padding: 0 6px 6px; }
.canned-pick button { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 8px; background: none; }
.canned-pick button.on { background: var(--brand-soft); }
.canned-pick .pk-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.canned-pick .pk-top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canned-pick .pk-sc { font-family: "Geist Mono", ui-monospace, monospace; font-size: 12px; color: var(--brand); flex: none; }
.canned-pick .pk-body { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canned-pick .pk-empty { padding: 10px 14px 14px; color: var(--muted); }
.canned-pick .pk-foot { border-top: 1px solid var(--line-2); padding: 8px 14px; font-size: 12.5px; }
.canned-pick .pk-manage { text-decoration: none; font-weight: 500; }

/* quick replies settings */
.canned-table td { vertical-align: top; }
.canned-table td:nth-child(2) { max-width: 420px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.how-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--ink-2); }
.var-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip-btn { height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--line-2); font-family: "Geist Mono", ui-monospace, monospace; font-size: 12px; color: var(--ink-2); }
.chip-btn:hover { border-color: var(--brand); color: var(--brand); }
.prefix-input { display: flex; align-items: stretch; }
.prefix-input span { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; background: var(--line-2); color: var(--muted); font-family: "Geist Mono", ui-monospace, monospace; }
.prefix-input .input { border-radius: 0 10px 10px 0; }
@media (max-width: 860px) {
  .canned-pick { left: 10px; right: 10px; }
  .canned-pick .pk-list { max-height: 45vh; }
}
.starter-list { display: grid; gap: 4px; }
.starter-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.starter-item:hover { background: var(--line-2); }
.starter-item input { margin-top: 3px; flex: none; }
.starter-item > .grow { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.starter-item.added { opacity: .6; cursor: default; }

/* ── satisfaction ratings in the thread ── */
.stars { color: #f5b301; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: #d9d9d4; }
.sys-row { display: flex; justify-content: center; margin: 14px 0; }
.sys-rating { max-width: 440px; padding: 8px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sys-rating > span:last-of-type { color: var(--muted); }
.sys-comment { color: var(--ink); font-size: 13px; white-space: pre-wrap; }

/* ── reports ── */
.rep-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.rep-head h1 { margin: 0; }
.rep-head .sub { margin: 4px 0 0; }
.stats.kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi .v { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 24px; }
.kpi .s { font-size: 12px; }
.delta { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.delta.good { color: var(--ok); }
.delta.bad { color: var(--danger); }
.rep-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.rc-h { margin-bottom: 14px; }
.rc-h h3 { font-size: 15px; margin: 0; }
.rc-h p { margin: 3px 0 0; }
.rc-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 20px 0 8px; }
.rep-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.rep-grid .rep-card { margin-bottom: 16px; }

.bars { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; height: 200px; align-items: stretch; }
.bar-col { display: flex; flex-direction: column; min-width: 0; }
.bar-track { flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
.vbar { position: relative; width: 100%; max-width: 38px; margin: 0 auto; min-height: 0; background: var(--brand); border-radius: 4px 4px 0 0; display: flex; align-items: flex-end; overflow: hidden; transition: height .5s var(--ease-out); }
.bar-col:hover .vbar { background: var(--brand-2); }
.bar-miss { width: 100%; background: #f0a36b; }
.bar-lbl { height: 18px; margin-top: 6px; font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: visible; }
.chart-legend { display: flex; align-items: center; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg-a { background: var(--brand); }
.lg-m { background: #f0a36b; }

.heat { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 3px; }
.heat .hh { font-size: 10.5px; color: var(--muted); text-align: left; height: 14px; }
.heat .hd { font-size: 11.5px; color: var(--ink-2); display: flex; align-items: center; }
.heat .hc { aspect-ratio: 1; border-radius: 4px; background: color-mix(in srgb, var(--brand) calc(var(--a) * 100%), #f1f1ee); min-height: 12px; }
.heat-scale { width: 120px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #f1f1ee, var(--brand)); }

.dist { display: grid; gap: 8px; }
.dist-row { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: 10px; font-size: 12.5px; }
.dist-k { color: var(--ink-2); white-space: nowrap; }
.dist-bar { height: 8px; border-radius: 4px; background: #f1f1ee; overflow: hidden; }
.dist-bar i { display: block; height: 100%; background: #f5b301; border-radius: 4px; }
.dist-n { text-align: right; color: var(--muted); }
.rv-list { display: grid; gap: 8px; max-height: 360px; overflow-y: auto; }
.rv { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; text-decoration: none; color: inherit; }
.rv:hover { border-color: var(--line); background: #fafaf8; }
.rv-c { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.rep-table td, .rep-table th { white-space: nowrap; }

@media (max-width: 1280px) { .stats.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) { .rep-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .stats.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rep-card { padding: 14px; }
  .bars { height: 160px; gap: 2px; }
  .heat { grid-template-columns: 28px repeat(24, minmax(0, 1fr)); gap: 2px; }
  .heat .hc { border-radius: 2px; min-height: 8px; }
}

/* ── tags ── */
.tag-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--tc) 13%, #fff); color: color-mix(in srgb, var(--tc) 78%, #000); }
.tag-chip button { border: 0; background: none; padding: 0 0 0 2px; font-size: 14px; line-height: 1; color: inherit; opacity: .55; }
.tag-chip button:hover { opacity: 1; }
.tag-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tc); flex: none; }
.c-chips { flex-wrap: wrap; gap: 4px; }
.c-chips .tag-chip { height: 20px; font-size: 11px; padding: 0 7px; }
.tag-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 20px; background: var(--panel); border-bottom: 1px solid var(--line-2); min-height: 38px; }
.tag-add { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 12px; border: 1px dashed #cfcfc9; background: none; font-size: 12px; font-weight: 500; color: var(--muted); }
.tag-add:hover { border-color: var(--brand); color: var(--brand); }
.search-row { gap: 8px; flex-wrap: nowrap; }
.tag-filter { flex: none; height: 38px; padding: 0 11px; gap: 6px; max-width: 150px; }
.tag-filter.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.tag-filter .tf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.tag-menu { width: 260px; }
.tag-pick .input { height: 34px; margin-bottom: 6px; }
.tag-pick #tagOpts { max-height: 280px; overflow-y: auto; }
.tag-opt { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.tag-opt:hover { background: var(--line-2); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sw { position: relative; cursor: pointer; }
.sw input { position: absolute; opacity: 0; pointer-events: none; }
.sw span { display: block; width: 22px; height: 22px; border-radius: 50%; background: var(--tc); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); transition: transform .12s ease; }
.sw:hover span { transform: scale(1.1); }
.sw input:checked + span { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--tc); }
.sw input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 3px; }

/* transfer */
.sys-event { max-width: 460px; padding: 8px 14px; border-radius: 12px; background: #f1f1ee; border: 1px dashed #d6d6cf; font-size: 12.5px; color: var(--ink-2); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sys-event > svg { color: var(--muted); }
.tr-list { display: grid; gap: 4px; max-height: 320px; overflow-y: auto; }
.tr-opt { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; }
.tr-opt:hover { background: var(--line-2); }
.tr-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.tr-opt input { flex: none; }
.tr-queue { width: 28px; height: 28px; border-radius: 50%; background: var(--line-2); display: grid; place-items: center; color: var(--muted); flex: none; }

/* report topics */
.topics { display: grid; gap: 4px; }
.topic { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 90px minmax(0, 220px); align-items: center; gap: 14px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: inherit; }
.topic:hover { background: #fafaf8; }
.tp-bar { height: 10px; border-radius: 5px; background: #f1f1ee; overflow: hidden; }
.tp-bar i { display: block; height: 100%; border-radius: 5px; background: var(--tc); }
.tp-n { font-size: 13px; white-space: nowrap; }
.tp-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) {
  .tag-bar { padding: 8px 12px; }
  .topic { grid-template-columns: minmax(80px, 120px) 1fr 70px; }
  .tp-meta { display: none; }
}

/* ── inactivity automation ── */
.idle-flow { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 8px; }
.if-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.if-step { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 6px; border-radius: 17px; background: var(--brand-soft); color: var(--ink); font-size: 13px; font-weight: 600; }
.if-ic { width: 24px; height: 24px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 12px; }
.if-gap { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.if-gap i { width: 18px; height: 1px; background: #cfcfc9; }
.if-gap b { font-weight: 600; white-space: nowrap; }
.if-off { color: var(--muted); font-size: 13px; }
.m-auto { display: inline-flex; align-items: center; gap: 4px; margin: 3px 4px 0; font-size: 11px; color: var(--muted); }
.m-auto svg { width: 11px; height: 11px; }
.m-auto.warn-text { color: #b45309; }

/* ── translation ── */
.m-tr { display: inline-flex; align-items: center; gap: 4px; margin: 3px 4px 0; padding: 0; border: 0; background: none; font-size: 11px; color: var(--muted); cursor: pointer; }
.m-tr svg { width: 11px; height: 11px; }
.m-tr u { text-decoration: none; color: var(--brand); }
.m-tr:hover u { text-decoration: underline; }
.tr-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--brand-soft); background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tr-chip svg { width: 13px; height: 13px; }
.tr-chip.off { background: none; border-color: var(--line); color: var(--muted); text-decoration: line-through; }

/* ── player profile ── */
.side-sec h4 .verified { margin-left: 8px; padding: 1px 7px; border-radius: 9px; background: #dcfce7; color: #166534; font-size: 10.5px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.rel-h { margin: 14px 0 6px; }
.rel { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: inherit; border: 1px solid var(--line-2); margin-bottom: 6px; }
.rel:hover { background: #fafaf8; border-color: var(--line); }
.rel .grow { display: flex; flex-direction: column; min-width: 0; }
.rel-prev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

/* ── widget sounds ── */
.snd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.snd-grid.off { opacity: .45; }
.snd { position: relative; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.snd:hover { border-color: #cfcfc9; }
.snd.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.snd-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; height: 46px; padding: 0 12px; border: 0; background: none; font-weight: 600; font-size: 13px; text-align: left; }
.snd-ic { font-size: 18px; line-height: 1; }
.snd-play { flex: none; width: 32px; height: 32px; margin-right: 7px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); display: grid; place-items: center; }
.snd-play:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.snd-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.snd-toggle .btn svg { width: 11px; height: 11px; }

/* ── two-step verification ── */
.tfa-code { font-family: "Geist Mono", ui-monospace, monospace; font-size: 22px; letter-spacing: .3em; text-align: center; }
.tfa-qr { display: grid; place-items: center; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.tfa-qr svg { width: 190px; height: 190px; }
.tfa-secret { display: block; word-break: break-all; font-size: 13px; letter-spacing: .05em; }
.tfa-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tfa-codes code { padding: 8px 10px; border-radius: 8px; background: var(--line-2); font-family: "Geist Mono", ui-monospace, monospace; font-size: 14px; text-align: center; }

/* Platform admin signed in as someone else */
#impBar { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; align-items: center; gap: 12px;
  max-width: calc(100vw - 32px); padding: 8px 8px 8px 16px; border-radius: 999px; background: #1f2330; color: #fff; font-size: 13px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); }
#impBar b { font-weight: 600; }
#impBar button { flex: none; border: 0; border-radius: 999px; padding: 6px 12px; background: #f5b400; color: #1f2330; font-weight: 600; cursor: pointer; }
@media (max-width: 560px) { #impBar { bottom: 76px; font-size: 12px; } }

/* Per-language versions of a widget message */
.lang-versions { margin-top: 8px; }
.lang-versions summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent, #2f5bea); padding: 4px 0; }
.lang-versions .lv { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: start; margin-top: 8px; font-size: 13px; }
.lang-versions .lv span { padding-top: 9px; color: #4a4c55; }
@media (max-width: 560px) { .lang-versions .lv { grid-template-columns: 1fr; gap: 4px; } .lang-versions .lv span { padding-top: 0; } }

/* Document attachments in the thread */
.bubble.file { display: flex; align-items: center; gap: 10px; min-width: 200px; max-width: 280px; text-decoration: none; color: inherit; }
.bubble.file .fi { flex: none; width: 36px; height: 36px; border-radius: 9px; background: rgba(0, 0, 0, .06); display: flex; align-items: center; justify-content: center; }
.bubble.file .fn { display: flex; flex-direction: column; min-width: 0; }
.bubble.file b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble.file .fn span { font-size: 12px; opacity: .7; }
a.bubble.file:hover b { text-decoration: underline; }
.attach-chip svg { flex: none; }

/* Quick menu editor */
.q-list { display: flex; flex-direction: column; gap: 12px; }
.q-row { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line, #e3e3de); border-radius: 12px; background: #fff; }
.q-top { display: flex; gap: 8px; align-items: center; }
.q-top .q-lang { width: 150px; flex: none; }
.q-row label.small { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 560px) { .q-top { flex-wrap: wrap; } .q-top .q-lang { width: 100%; } }

/* AI assistant */
#aiBtn.busy svg { animation: ai-pulse 1s ease-in-out infinite; }
@keyframes ai-pulse { 50% { opacity: .35; } }
.ai-sum { white-space: pre-wrap; line-height: 1.6; padding: 14px 16px; border-radius: 12px; background: #f6f6f3; border: 1px solid #e3e3de; max-height: 50vh; overflow: auto; }
.modal h3 svg { display: inline-block; vertical-align: -2px; color: #6b4fbb; }

/* Telegram channel */
.ch-tg { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 18px; height: 18px; border-radius: 50%; background: #229ed9; color: #fff; margin-right: 4px; }
.ch-tg svg { width: 11px; height: 11px; }
.tg-steps, .tg-notes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }
.pill.ok svg { display: inline-block; vertical-align: -2px; color: #229ed9; }

/* Live visitors */
.vip-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: #fdf1cc; color: #7a5200; vertical-align: 1px; }
.vis-table .vis-page { max-width: 340px; }
.vis-table .vis-page div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .badge.soft { background: #1f9d55; }
.camp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.camp-grid label { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 760px) { .camp-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .savebar { padding: 12px; }
  .savebar > .grow { flex-basis: calc(100% - 20px); }
  .savebar .btn { flex: 1 1 auto; justify-content: center; }
}

/* Grid/flex children may shrink below their content, so wide tables scroll inside their box instead of widening the page. */
.sec > *, .sbody > * { min-width: 0; }

/* Billing */
.bill-status { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 12px; background: #eef2ff; border: 1px solid #d8e0fb; margin-bottom: 18px; }
.bill-status.past_due, .bill-status.canceled { background: #fdf0e6; border-color: #f3d2b6; color: #7a3a0c; }
.bill-status.active { background: #eaf6ef; border-color: #cde9d8; color: #185c34; }
.billing { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: #fff; border: 1px solid var(--line); margin-bottom: 16px; }
.billing button { min-height: 38px; padding: 0 16px; border: 0; border-radius: 9px; font: inherit; font-weight: 600; background: transparent; cursor: pointer; }
.billing button[aria-checked="true"] { background: #16171b; color: #fff; }
.bill-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 340px)); gap: 14px; }
.bill-plan { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.bill-plan .bp-top { display: flex; justify-content: space-between; align-items: center; font-size: 17px; }
.bp-price b { font-size: 28px; font-weight: 800; }
.bp-price span { color: var(--muted); margin-left: 4px; }
.bill-plan p { margin: 4px 0 8px; flex: 1; }
.blocked-billing { max-width: 820px; margin: 28px auto 0; text-align: left; }
@media (max-width: 760px) { .bill-plans { grid-template-columns: 1fr; } }
.trial-pill { position: fixed; right: 16px; bottom: 16px; z-index: 50; padding: 9px 16px; border-radius: 999px; background: #16171b; color: #fff !important; font-size: 13px; font-weight: 600; text-decoration: none; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.trial-pill.warn { background: #b3261e; }
@media (max-width: 860px) {
  .trial-pill { bottom: 76px; right: 12px; }
  /* never over the reply box, a Save bar or a dialog */
  body:has(.main.has-thread) .trial-pill, body:has(.savebar) .trial-pill, body:has(.modal-bg) .trial-pill { display: none; }
}
.su-terms { align-items: flex-start; gap: 8px; margin: 4px 0 14px; font-size: 13.5px; line-height: 1.5; }
.su-terms input { margin-top: 3px; }

/* Irreversible actions: close workspace, delete account */
.danger-zone { margin-top: 36px; padding: 18px 20px; border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: 12px; max-width: 980px; }
.danger-zone h3 { margin: 0 0 4px; font-size: 15px; color: var(--danger); }
.danger-zone p { margin: 0 0 14px; }
.danger-note { margin: 0 0 16px; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 8%, transparent); font-size: 13.5px; }
.danger-note ul { margin: 0 0 10px; padding-left: 20px; font-weight: 600; }

/* Sign-in pages: language picker (a select styled as the small button) */
.lang-switch select { border: 0; background: transparent; font: inherit; color: inherit; padding: 0 2px; cursor: pointer; -webkit-appearance: none; appearance: none; }
.lang-switch select:focus { outline: none; }
.lang-switch:focus-within { box-shadow: 0 0 0 3px var(--brand-soft); }
.export-box { margin-top: 36px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; max-width: 980px; }
.export-box h3 { margin: 0 0 4px; font-size: 15px; }
.export-box p { margin: 0 0 14px; }
.side-sec h4 .unverified { margin-left: 8px; padding: 1px 7px; border-radius: 9px; background: #fef3c7; color: #92400e; font-size: 10.5px; font-weight: 700; letter-spacing: 0; text-transform: none; cursor: help; }
.warn-note { color: #92400e; }
.lang-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.lang-tabs button { padding: 5px 12px; border: 1px solid var(--line); background: var(--bg-1, #fff); border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.lang-tabs button.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }

/* AI auto-reply knowledge list */
.kb-list { display: flex; flex-direction: column; gap: 6px; }
.kb-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 13.5px; font-weight: 500; }
.kb-item:hover { border-color: #c9cbd3; }
.kb-item:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kv-grid > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; background: #fafaf8; }
.adv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tool-list { display: flex; flex-direction: column; gap: 8px; }
.tool { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.tool .row { gap: 8px; align-items: center; }
.tool p { margin: 6px 0 0; font-size: 13px; }
.tool.off { opacity: .65; }
@media (max-width: 760px) { .kv-grid, .adv-grid { grid-template-columns: 1fr; } }
/* A checkbox drawn as a switch (inside forms, so snapForm / dirty tracking just work). */
.cswitch { position: relative; display: inline-block; flex: none; }
.cswitch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.cswitch span { position: relative; display: block; width: 38px; height: 22px; border-radius: 11px; background: #cfd1d7; transition: background .15s ease; }
.cswitch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s ease; }
.cswitch input:checked + span { background: var(--brand); }
.cswitch input:checked + span::after { left: 19px; }
.cswitch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Connection lost / new version: a quiet bar at the top, above everything. */
.rt-banner { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 4000; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; background: #1f2430; color: #fff; font-size: 13px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.18); max-width: calc(100vw - 24px); }
.rt-banner.ver { top: 52px; background: var(--brand); padding-right: 6px; }
.rt-banner.ver .btn { background: #fff; color: #111; border: 0; }

/* ── touch screens: controls big enough for a thumb ── */
@media (pointer: coarse) {
  .cmp-tabs button { height: 40px; padding: 0 14px; font-size: 14px; }
  .m-fail { gap: 4px 18px; }
  .m-fail button { min-height: 40px; padding: 0 6px; }
  .thread-head .btn.sm, .composer .btn.sm { height: 40px; min-width: 40px; }
}
/* a narrow phone: the inbox tabs scroll sideways instead of overflowing (longer Malay labels) */
@media (max-width: 420px) {
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 1 0 auto; padding: 0 8px; }
}

/* ── first steps / install status ── */
.setup-card { margin: 22px auto 0; max-width: 360px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; color: var(--ink); }
.setup-card ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.setup-card li { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.setup-card li a { color: var(--ink); font-weight: 500; }
.setup-card li.done a { color: var(--muted); text-decoration: line-through; }
.setup-card .tick { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.setup-card li.done .tick { background: var(--ok, #16a34a); border-color: transparent; color: #fff; }
.install-seen { margin-bottom: 18px; }
.ok-notice { background: color-mix(in srgb, #16a34a 9%, #fff); border-color: color-mix(in srgb, #16a34a 30%, transparent); }
.paste-help details { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; margin-bottom: 6px; background: #fff; }
.paste-help summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.paste-help p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; }
.search-note { padding: 8px 16px; font-size: 12px; color: var(--muted); background: #fafaf8; border-bottom: 1px solid var(--line-2); }

/* ── ✨ AI help me write ── */
.ai-write { margin-top: 8px; }
.ai-write-panel { margin-top: 8px; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; }
.ai-write-panel .row { gap: 8px; }
.ai-write-panel select.input { width: auto; }
.ai-write-panel [data-aiw-brief] { min-width: 220px; } /* on a phone the language and button wrap below it */
.ai-write-out:empty { display: none; }
.ai-write-out .hint { margin: 10px 0 6px; }
.ai-opt { display: block; width: 100%; text-align: left; margin: 0 0 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: inherit; font: inherit; line-height: 1.5; cursor: pointer; }
.ai-opt:hover { border-color: var(--brand, #2f5bea); }
.ai-opt.on { border-color: var(--brand, #2f5bea); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand, #2f5bea) 22%, transparent); }
