/* Pulse Inbox — design system + layout */
:root {
  --brand: #0e9f6e;
  --brand-600: #0b8a5f;
  --brand-50: #e7f7f0;
  --brand-ink: #ffffff;
  --blue: #3b82f6;
  --red: #ef4444;
  --amber: #f59e0b;
  --violet: #8b5cf6;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f3;
  --line: #e4e7ec;
  --line-2: #d6dae1;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #8a93a3;
  --hover: rgba(17, 24, 39, 0.045);
  --active: rgba(14, 159, 110, 0.1);

  --chat-bg: #efeae2;
  --chat-dot: rgba(0, 0, 0, 0.035);
  --bubble-in: #ffffff;
  --bubble-out: #d9fdd3;
  --bubble-note: #fff5c2;
  --bubble-note-line: #f2d56b;
  --bubble-ink: #111b21;
  --bubble-meta: #667781;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-2: 0 8px 24px rgba(16, 24, 40, 0.12), 0 2px 6px rgba(16, 24, 40, 0.06);
  --shadow-3: 0 24px 60px rgba(16, 24, 40, 0.22);
  --rail: 72px;
  --list: 372px;
  --panel: 340px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans Arabic", "Noto Sans", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #21c087; --brand-600: #1aa674; --brand-50: rgba(33, 192, 135, 0.14); --brand-ink: #04140d;
    --bg: #0b0f16; --surface: #111722; --surface-2: #151c29; --surface-3: #1c2433;
    --line: #232c3b; --line-2: #2e384a; --text: #e8ecf2; --text-2: #aab3c2; --text-3: #758095;
    --hover: rgba(255, 255, 255, 0.05); --active: rgba(33, 192, 135, 0.14);
    --chat-bg: #0c1219; --chat-dot: rgba(255, 255, 255, 0.025);
    --bubble-in: #1c2533; --bubble-out: #0f5a43; --bubble-note: #3a3217; --bubble-note-line: #7a6421; --bubble-ink: #e9edef; --bubble-meta: #93a1ad;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 10px 30px rgba(0,0,0,.45); --shadow-3: 0 24px 60px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #21c087; --brand-600: #1aa674; --brand-50: rgba(33, 192, 135, 0.14); --brand-ink: #04140d;
  --bg: #0b0f16; --surface: #111722; --surface-2: #151c29; --surface-3: #1c2433;
  --line: #232c3b; --line-2: #2e384a; --text: #e8ecf2; --text-2: #aab3c2; --text-3: #758095;
  --hover: rgba(255, 255, 255, 0.05); --active: rgba(33, 192, 135, 0.14);
  --chat-bg: #0c1219; --chat-dot: rgba(255, 255, 255, 0.025);
  --bubble-in: #1c2533; --bubble-out: #0f5a43; --bubble-note: #3a3217; --bubble-note-line: #7a6421; --bubble-ink: #e9edef; --bubble-meta: #93a1ad;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 10px 30px rgba(0,0,0,.45); --shadow-3: 0 24px 60px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14.5px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overscroll-behavior: none; overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--brand); }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.xs { width: 13px; height: 13px; }
svg.i.lg { width: 24px; height: 24px; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: 10px; font-weight: 600; font-size: 14px; background: var(--surface); border: 1px solid var(--line-2);
  color: var(--text); transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-600); }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--text-2);
  transition: background .15s, color .15s; position: relative; flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { color: var(--brand); background: var(--active); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }

.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.select { appearance: none; background-image: 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='%238a93a3' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
label.field .hint { font-weight: 400; color: var(--text-3); font-size: 12.5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 24px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; flex: none;
}
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip .count { font-size: 11.5px; opacity: .7; font-weight: 700; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--c, #6366f1) 14%, transparent); color: color-mix(in srgb, var(--c, #6366f1) 80%, var(--text));
}
.tag .x { opacity: .6; cursor: pointer; margin-right: -3px; }
.tag .x:hover { opacity: 1; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--brand)); display: inline-block; flex: none; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.pill { white-space: nowrap; flex: none; display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .01em; }
.pill.open { background: rgba(16,185,129,.14); color: #059669; }
.pill.pending { background: rgba(245,158,11,.16); color: #b45309; }
.pill.closed { background: var(--surface-3); color: var(--text-3); }
.pill.warn { background: rgba(239,68,68,.12); color: #dc2626; }
.pill.info { background: rgba(59,130,246,.12); color: #2563eb; }
:root[data-theme="dark"] .pill.open, :root:not([data-theme="light"]) .pill.open { color: #34d399; }

.avatar {
  --c: #6366f1; width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 85%, #fff), var(--c));
  letter-spacing: .02em; user-select: none;
}
.avatar.sm { width: 34px; height: 34px; font-size: 12.5px; }
.avatar.lg { width: 84px; height: 84px; font-size: 28px; }

/* ---------- app shell ---------- */
#app { height: 100dvh; display: flex; }
.rail {
  width: var(--rail); flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; padding: calc(14px + var(--safe-top)) 0 14px; gap: 6px; z-index: 5;
}
.rail .logo { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 14px; background: linear-gradient(135deg, #16c784, #0b8a5f); color: #fff; box-shadow: 0 6px 16px rgba(14,159,110,.35); }
.rail a { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: var(--text-3); position: relative; transition: .15s; }
.rail a:hover { background: var(--hover); color: var(--text); }
.rail a.on { background: var(--active); color: var(--brand); }
.rail a .badge { position: absolute; top: 3px; right: 1px; height: 18px; min-width: 18px; font-size: 10.5px; border: 2px solid var(--surface); }
.rail .spacer { flex: 1; }
.rail a[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 58px; top: 50%; transform: translateY(-50%); background: #111827; color: #fff;
  font-size: 12.5px; font-weight: 600; padding: 5px 9px; border-radius: 7px; white-space: nowrap; pointer-events: none; z-index: 50;
}
.main { flex: 1; min-width: 0; min-height: 0; display: flex; position: relative; }

.tabbar { display: none; }

/* ---------- inbox layout ---------- */
.inbox { flex: 1; display: flex; min-width: 0; min-height: 0; }
.list-pane { width: var(--list); flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-pane { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--chat-bg); position: relative; }
.panel-pane { width: var(--panel); flex: none; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }

.pane-head { padding: calc(16px + var(--safe-top)) 16px 10px; display: flex; flex-direction: column; gap: 12px; }
.pane-head h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search .input { padding-left: 38px; background: var(--surface-2); border-color: transparent; }
.search .input:focus { background: var(--surface); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 16px 10px; margin: 0 -16px -10px; }
.chips::-webkit-scrollbar { display: none; }

.conv-list { flex: 1; min-height: 0; padding: 4px 8px 8px; }
.conv {
  display: flex; gap: 12px; padding: 11px 10px; border-radius: 12px; cursor: pointer; position: relative; align-items: center; transition: background .12s;
  user-select: none; -webkit-user-select: none;
}
.conv:hover { background: var(--hover); }
.conv.on { background: var(--active); }
.conv .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.conv .top, .conv .bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.conv .name { font-weight: 650; font-size: 15px; flex: 1; min-width: 0; }
.conv .time { font-size: 12px; color: var(--text-3); flex: none; }
.conv.unread .time { color: var(--brand); font-weight: 700; }
.conv .preview { flex: 1; min-width: 0; color: var(--text-3); font-size: 13.5px; display: flex; align-items: center; gap: 4px; }
.conv.unread .preview { color: var(--text); font-weight: 550; }
.conv .icons { display: flex; align-items: center; gap: 4px; color: var(--text-3); flex: none; }
.conv .tagdots { display: flex; gap: 3px; }
.conv .window-bar { position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--amber), transparent); opacity: .8; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 40px 24px; color: var(--text-3); height: 100%; }
.empty .art { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.empty h3 { margin: 4px 0 0; color: var(--text); font-size: 17px; }
.empty p { margin: 0; max-width: 340px; }

/* category tabs */
.cat-tabs { display: flex; gap: 4px; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.cat-tab {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 5px; height: 34px; border-radius: 9px;
  font-size: 12.5px; font-weight: 650; color: var(--text-3); transition: background .15s, color .15s; padding: 0 4px;
}
.cat-tab .dot { width: 7px; height: 7px; }
.cat-tab.all { flex: 0 0 46px; }
.cat-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-tab:hover { color: var(--text); }
.cat-tab.on { background: var(--surface); color: var(--c, var(--text)); box-shadow: var(--shadow-1); }
.cat-tab .count { font-size: 11px; font-weight: 700; opacity: .6; }
.cat-tab .badge { height: 17px; min-width: 17px; font-size: 10.5px; padding: 0 4px; }
.cat-tab svg { flex: none; }
@media (max-width: 380px) { .cat-tab { font-size: 11.5px; padding: 0 2px; } }
.cat-dot {
  flex: none; width: 16px; height: 16px; border-radius: 5px; font-size: 9.5px; font-weight: 800; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c);
}
.cat-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); white-space: nowrap; }

/* ---------- chat ---------- */
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-top)) 12px 10px; min-height: 64px;
  background: var(--surface); border-bottom: 1px solid var(--line); z-index: 3;
}
.chat-head .who { flex: 1; min-width: 0; cursor: pointer; display: flex; flex-direction: column; }
.chat-head .who b { font-size: 15.5px; font-weight: 650; }
.chat-head .who small { color: var(--text-3); font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.chat-head .back { display: none; }
.status-select { width: auto; flex: none; height: 34px; border-radius: 9px; font-weight: 650; font-size: 13px; padding: 0 30px 0 12px; border: 1px solid var(--line-2); background-color: var(--surface); }

.messages {
  flex: 1; min-height: 0; padding: 14px 6% 10px; position: relative;
  background-color: var(--chat-bg);
  background-image: radial-gradient(var(--chat-dot) 1.2px, transparent 1.2px);
  background-size: 18px 18px;
}
@media (max-width: 1200px) { .messages { padding: 14px 18px 10px; } }
.day-sep { display: flex; justify-content: center; margin: 14px 0 10px; pointer-events: none; }
.day-sep span { background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 650; padding: 5px 12px; border-radius: 8px; box-shadow: var(--shadow-1); }
.unread-sep { text-align: center; margin: 10px 0; font-size: 12px; font-weight: 700; color: var(--brand); }
.unread-sep span { background: var(--surface); padding: 4px 12px; border-radius: 8px; box-shadow: var(--shadow-1); }
.system { display: flex; justify-content: center; margin: 8px 0; }
.system span { font-size: 12px; color: var(--text-2); background: color-mix(in srgb, var(--surface) 80%, transparent); padding: 4px 10px; border-radius: 8px; display: inline-flex; gap: 6px; align-items: center; }

.msg { display: flex; margin: 2px 0; position: relative; }
.msg.out { justify-content: flex-end; }
.msg.note { justify-content: flex-end; }
.msg.first { margin-top: 8px; }
.bubble {
  position: relative; max-width: min(560px, 78%); padding: 6px 9px 7px; border-radius: 10px; color: var(--bubble-ink);
  background: var(--bubble-in); box-shadow: 0 1px .5px rgba(11, 20, 26, .13); word-wrap: break-word; overflow-wrap: anywhere; min-width: 84px;
}
.msg.out .bubble { background: var(--bubble-out); }
.msg.note .bubble { background: var(--bubble-note); border: 1px dashed var(--bubble-note-line); box-shadow: none; }
.msg.first.in .bubble { border-top-left-radius: 3px; }
.msg.first.out .bubble { border-top-right-radius: 3px; }
.msg.first.in .bubble::before, .msg.first.out .bubble::before {
  content: ""; position: absolute; top: 0; width: 9px; height: 13px; background: inherit;
}
.msg.first.in .bubble::before { left: -8px; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.msg.first.out .bubble::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.bubble .text { white-space: pre-wrap; font-size: 14.5px; line-height: 1.42; }
.bubble .text a { color: #027eb5; }
.bubble .meta { float: right; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--bubble-meta); margin: 6px 0 -4px 10px; position: relative; top: 3px; white-space: nowrap; }
.bubble .meta .tick { width: 16px; height: 16px; }
.bubble .meta .tick.read { color: #53bdeb; }
.bubble .meta .tick.failed { color: var(--red); }
.bubble .label { font-size: 11.5px; font-weight: 700; display: flex; align-items: center; gap: 4px; margin-bottom: 3px; }
.bubble .label.note { color: #a16207; }
.bubble .label.auto { color: var(--violet); }
.bubble .label.tpl { color: #0e7490; }
:root[data-theme="dark"] .bubble .label.note { color: #facc15; }
.bubble .err { margin-top: 6px; font-size: 12px; color: var(--red); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bubble .err button { color: var(--red); font-weight: 700; text-decoration: underline; }
.bubble .quote { background: rgba(0,0,0,.05); border-left: 4px solid var(--brand); border-radius: 7px; padding: 5px 8px; margin: 1px 0 5px; font-size: 13px; cursor: pointer; }
.msg.out .bubble .quote { background: rgba(0,0,0,.06); }
.bubble .quote b { color: var(--brand); font-size: 12.5px; display: block; }
.bubble .quote span { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
:root[data-theme="dark"] .bubble .quote { background: rgba(255,255,255,.06); }
.bubble .media { margin: -3px -6px 4px; border-radius: 8px; overflow: hidden; background: rgba(0,0,0,.06); display: block; max-width: 330px; }
.bubble .media img, .bubble .media video { display: block; width: 100%; max-height: 360px; object-fit: cover; cursor: zoom-in; }
.bubble .media.pending { height: 180px; width: 260px; display: grid; place-items: center; color: var(--text-3); font-size: 12.5px; }
.bubble .sticker img { width: 150px; height: 150px; object-fit: contain; background: transparent; }
.bubble .doc { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: rgba(0,0,0,.05); border-radius: 8px; margin-bottom: 4px; text-decoration: none; color: inherit; min-width: 220px; }
.bubble .doc .ico { width: 36px; height: 42px; border-radius: 6px; background: #ef4444; color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 800; flex: none; }
.bubble .doc small { color: var(--bubble-meta); display: block; }
.bubble .loc { display: block; width: 260px; margin: -3px -6px 4px; border-radius: 8px; overflow: hidden; text-decoration: none; color: inherit; }
.bubble .loc .map { height: 120px; background: linear-gradient(135deg, #cfe9d9, #b9dcf3); position: relative; }
.bubble .loc .map::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.55) 2px, transparent 2px), linear-gradient(90deg, rgba(255,255,255,.55) 2px, transparent 2px); background-size: 34px 34px; transform: rotate(-12deg) scale(1.4); }
.bubble .loc .map svg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -80%); color: #ef4444; width: 34px; height: 34px; fill: #ef4444; stroke: #fff; }
.bubble .loc .cap { padding: 6px 8px; font-size: 13px; }
.bubble .buttons { clear: both; display: flex; flex-direction: column; margin: 7px -9px -7px; border-top: 1px solid rgba(0,0,0,.08); }
.bubble .buttons div { text-align: center; padding: 9px; color: #027eb5; font-weight: 600; font-size: 14px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.bubble .buttons div + div { border-top: 1px solid rgba(0,0,0,.08); }
:root[data-theme="dark"] .bubble .buttons div { color: #53bdeb; }
.bubble .reply-chip { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--bubble-meta); margin-bottom: 3px; }
.bubble .reactions { position: absolute; bottom: -14px; display: flex; gap: 2px; background: var(--surface); border-radius: 12px; padding: 1px 5px; box-shadow: var(--shadow-1); font-size: 14px; z-index: 1; }
.msg.in .bubble .reactions { left: 8px; }
.msg.out .bubble .reactions { right: 8px; }
.msg.has-react { margin-bottom: 16px; }
.bubble .star { color: var(--amber); }
.msg .actions {
  position: absolute; top: -6px; display: none; gap: 2px; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-2); padding: 3px; z-index: 4;
}
.msg.in .actions { left: min(calc(78% + 6px), 566px); }
.msg.out .actions, .msg.note .actions { right: min(calc(78% + 6px), 566px); }
@media (hover: hover) { .msg:hover .actions { display: flex; } }
.msg .actions button { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2); }
.msg .actions button:hover { background: var(--hover); color: var(--text); }
.msg.flash .bubble { animation: flash 1.2s ease; }
@keyframes flash { 0%, 100% { filter: none; } 30% { filter: brightness(.85); } }
.audio { display: flex; align-items: center; gap: 10px; min-width: 240px; padding: 2px 0; }
.audio .play { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.audio .wave { flex: 1; height: 28px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.audio .wave i { flex: 1; background: var(--bubble-meta); opacity: .35; border-radius: 2px; min-height: 3px; }
.audio .wave i.on { opacity: 1; background: var(--brand); }
.audio .dur { font-size: 11.5px; color: var(--bubble-meta); min-width: 34px; }
.msg.swipe .bubble { transition: none; }

.jump { position: absolute; right: 18px; bottom: 96px; width: 42px; height: 42px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-2); display: grid; place-items: center; color: var(--text-2); z-index: 5; }
.jump .badge { position: absolute; top: -6px; right: -4px; }

/* window banner */
.window-banner { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 13px; background: color-mix(in srgb, var(--amber) 14%, var(--surface)); color: var(--text); border-bottom: 1px solid var(--line); }
.window-banner.closed { background: color-mix(in srgb, var(--red) 10%, var(--surface)); }

/* AI suggestion card */
.ai-card {
  margin: 0 10px 0; padding: 10px 12px; border-radius: 14px 14px 0 0; border: 1px solid var(--line);
  border-bottom: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 9%, var(--surface)), var(--surface));
  display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 3; animation: rise .18s ease;
}
.ai-card.warn { background: linear-gradient(180deg, color-mix(in srgb, var(--amber) 14%, var(--surface)), var(--surface)); }
.ai-card .ai-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--brand); }
.ai-card.warn .ai-head { color: #b45309; }
.ai-card .ai-head b { font-size: 13px; }
.ai-card .ai-reason { font-size: 12.5px; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.ai-card textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; background: var(--surface);
  resize: none; font: inherit; font-size: 14.5px; line-height: 1.4; outline: none; max-height: 180px;
}
.ai-card textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.ai-card .ai-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-src { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--text-3); background: var(--surface-2); border-radius: 6px; padding: 2px 6px; }

/* composer */
.composer { background: var(--surface); border-top: 1px solid var(--line); padding: 8px 10px calc(8px + var(--safe-bottom)); position: relative; z-index: 4; }
.composer .mode { display: flex; gap: 4px; margin: 0 0 6px 4px; }
.composer .mode button { font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 7px; color: var(--text-3); }
.composer .mode button.on { background: var(--surface-3); color: var(--text); }
.composer .mode button.on.note { background: var(--bubble-note); color: #854d0e; }
.composer .bar { display: flex; align-items: flex-end; gap: 4px; }
.composer .field { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 22px; display: flex; align-items: flex-end; padding: 3px 4px; transition: border-color .15s; }
.composer.note-mode .field { background: var(--bubble-note); border-color: var(--bubble-note-line); }
.composer .field:focus-within { border-color: var(--brand); }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; resize: none; padding: 8px 6px; max-height: 160px; line-height: 1.4; font-size: 15px; }
.composer .send { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; transition: transform .1s, background .15s; }
.composer .send:hover { background: var(--brand-600); }
.composer .send:active { transform: scale(.94); }
.composer .send.rec { background: var(--red); color: #fff; }
.composer .reply-bar { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-left: 4px solid var(--brand); border-radius: 8px; padding: 6px 8px 6px 10px; margin: 0 0 8px; font-size: 13px; }
.composer .reply-bar .grow b { color: var(--brand); display: block; font-size: 12.5px; }
.composer .recording { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 12px; height: 44px; background: var(--surface-2); border-radius: 22px; color: var(--red); font-weight: 650; }
.composer .recording .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.composer .closed-cta { display: flex; align-items: center; gap: 12px; padding: 6px 4px; flex-wrap: wrap; }
.composer .closed-cta p { margin: 0; flex: 1; min-width: 200px; font-size: 13.5px; color: var(--text-2); }

.popover {
  position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-2); z-index: 60;
  min-width: 200px; padding: 6px; animation: pop .14s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.popover .item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: 14px; width: 100%; text-align: left; }
.popover .item:hover, .popover .item.sel { background: var(--hover); }
.popover .item .ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.popover .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.popover .item.danger { color: var(--red); }
.qr-pop { left: 10px; right: 10px; bottom: calc(100% + 6px); max-height: 300px; overflow-y: auto; }
.qr-pop .item { flex-direction: column; align-items: flex-start; gap: 2px; }
.qr-pop .item b { font-size: 13px; color: var(--brand); }
.qr-pop .item > span { font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.emoji-pop { width: 330px; max-width: calc(100vw - 20px); padding: 8px; }
.emoji-pop .tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 6px; }
.emoji-pop .tabs button { flex: 1; height: 32px; border-radius: 8px; font-size: 18px; }
.emoji-pop .tabs button.on { background: var(--surface-3); }
.emoji-pop .grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 230px; overflow-y: auto; }
.emoji-pop .grid button { height: 36px; font-size: 22px; border-radius: 8px; }
.emoji-pop .grid button:hover { background: var(--hover); }
.react-pop { display: flex; gap: 2px; padding: 5px; border-radius: 26px; min-width: 0; }
.react-pop button { width: 38px; height: 38px; border-radius: 50%; font-size: 23px; transition: transform .1s; }
.react-pop button:hover { transform: scale(1.2); background: var(--hover); }

/* contact panel */
.panel-head { display: flex; align-items: center; gap: 8px; padding: calc(14px + var(--safe-top)) 12px 8px 16px; min-height: 64px; border-bottom: 1px solid var(--line); }
.panel-head b { flex: 1; font-size: 15px; }
.panel-body { flex: 1; min-height: 0; }
.profile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 16px 16px; }
.profile h2 { margin: 6px 0 0; font-size: 19px; letter-spacing: -.01em; }
.profile .sub { color: var(--text-3); font-size: 13.5px; }
.profile .quick { display: flex; gap: 8px; margin-top: 10px; }
.profile .quick a, .profile .quick button { width: 64px; padding: 8px 0; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); text-decoration: none; border: 1px solid var(--line); }
.profile .quick a:hover, .profile .quick button:hover { color: var(--brand); border-color: var(--brand); }
.section { padding: 14px 16px; border-top: 1px solid var(--line); }
.section h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); display: flex; align-items: center; justify-content: space-between; }
.section h4 button { color: var(--brand); font-size: 12px; font-weight: 700; text-transform: none; letter-spacing: 0; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 10px; font-size: 13.5px; align-items: center; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; }
.kv input { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 7px; padding: 5px 7px; margin: -5px -7px; outline: 0; }
.kv input:hover { background: var(--surface-2); }
.kv input:focus { border-color: var(--brand); background: var(--surface); }
.tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.media-grid a { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); }
.media-grid img, .media-grid video { width: 100%; height: 100%; object-fit: cover; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-row div { background: var(--surface-2); border-radius: 10px; padding: 10px; text-align: center; }
.stat-row b { display: block; font-size: 17px; }
.stat-row small { color: var(--text-3); font-size: 11.5px; }
.countdown { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.countdown .ring { width: 38px; height: 38px; flex: none; }
.countdown b { display: block; font-size: 14px; }
.countdown small { color: var(--text-3); font-size: 12px; }

/* ---------- generic pages ---------- */
.page { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.page-head { display: flex; align-items: center; gap: 12px; padding: calc(18px + var(--safe-top)) 28px 14px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; flex: 1; min-width: 160px; }
.page-head .sub { color: var(--text-3); font-size: 13.5px; width: 100%; margin-top: -6px; }
.page-body { flex: 1; min-height: 0; padding: 4px 28px 32px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-pad { padding: 18px; }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card .desc { color: var(--text-3); font-size: 13.5px; margin: 0 0 14px; }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 28px; overflow-x: auto; scrollbar-width: none; }
.tabs-line button { padding: 10px 12px; font-weight: 650; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs-line button.on { color: var(--brand); border-color: var(--brand); }
.stack { display: flex; flex-direction: column; gap: 16px; max-width: 980px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }

/* KPIs & charts */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { padding: 16px 18px; }
.kpi small { color: var(--text-3); font-weight: 600; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi b { display: block; font-size: 28px; letter-spacing: -.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12.5px; font-weight: 700; }
.kpi .delta.up { color: #059669; } .kpi .delta.down { color: #dc2626; }
.charts { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 1100px) { .charts { grid-template-columns: 1fr; } }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); margin-top: 8px; flex-wrap: wrap; }
.chart .legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.heat { display: grid; grid-template-columns: 30px repeat(24, 1fr); gap: 2px; font-size: 10.5px; color: var(--text-3); }
.heat div.c { aspect-ratio: 1; border-radius: 3px; background: var(--brand); }
.bars .bar { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; margin: 8px 0; }
.bars .track { height: 10px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.bars .fill { height: 100%; border-radius: 6px; }
.funnel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.funnel div { background: var(--surface-2); border-radius: 10px; padding: 10px; }
.funnel b { font-size: 18px; display: block; }
.funnel small { color: var(--text-3); font-size: 12px; }
.funnel .p { font-size: 12px; font-weight: 700; color: var(--brand); }
.progress { height: 8px; background: var(--surface-3); border-radius: 6px; overflow: hidden; display: flex; }
.progress i { display: block; height: 100%; }
@media (max-width: 640px) { .funnel { grid-template-columns: repeat(3, 1fr); } }

/* modal / sheet */
.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 20, .45); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s ease; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-3); width: min(560px, 100%); max-height: min(88dvh, 860px); display: flex; flex-direction: column; animation: rise .18s ease; }
.modal.wide { width: min(880px, 100%); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px calc(14px + var(--safe-bottom)); border-top: 1px solid var(--line); flex-wrap: wrap; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 120; display: grid; place-items: center; }
.lightbox img, .lightbox video { max-width: 94vw; max-height: 88vh; border-radius: 6px; }
.lightbox .icon-btn { position: absolute; top: calc(12px + var(--safe-top)); right: 12px; color: #fff; }

/* phone preview (templates / broadcasts) */
.phone { background: var(--chat-bg); background-image: radial-gradient(var(--chat-dot) 1.2px, transparent 1.2px); background-size: 18px 18px; border-radius: 16px; padding: 16px 14px; min-height: 200px; border: 1px solid var(--line); }
.phone .bubble { max-width: 100%; }
.var-chip { display: inline-flex; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); cursor: pointer; }
.var-chip:hover { background: var(--brand-50); color: var(--brand); }

/* toasts */
.toasts { position: fixed; top: calc(14px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(440px, calc(100vw - 24px)); }
.toast { pointer-events: auto; background: #111827; color: #fff; padding: 11px 14px; border-radius: 12px; box-shadow: var(--shadow-2); font-size: 14px; display: flex; gap: 10px; align-items: center; animation: rise .2s ease; width: 100%; cursor: default; }
.toast.error { background: #b91c1c; }
.toast.msg { background: var(--surface); color: var(--text); border: 1px solid var(--line); cursor: pointer; }
.toast.msg .grow small { color: var(--text-3); display: block; }

/* login */
.login { flex: 1; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 10% -10%, var(--brand-50), transparent), var(--bg); }
.login .card { width: min(400px, 100%); padding: 32px 28px; }
.login .logo { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(135deg, #16c784, #0b8a5f); color: #fff; margin-bottom: 18px; box-shadow: 0 10px 24px rgba(14,159,110,.35); }
.login h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; }

.demo-banner { background: linear-gradient(90deg, #4f46e5, #7c3aed); color: #fff; font-size: 13px; padding: 7px 14px; display: flex; gap: 10px; align-items: center; justify-content: center; text-align: center; }
.demo-banner a { color: #fff; font-weight: 700; }

.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.drop-overlay { position: absolute; inset: 0; background: color-mix(in srgb, var(--brand) 16%, transparent); border: 3px dashed var(--brand); z-index: 20; display: grid; place-items: center; font-weight: 700; color: var(--brand); font-size: 18px; border-radius: 6px; pointer-events: none; }

/* ---------- responsive ---------- */
@media (max-width: 1279px) {
  .panel-pane { position: fixed; right: 0; top: 0; bottom: 0; z-index: 50; box-shadow: var(--shadow-3); transform: translateX(105%); transition: transform .22s ease; width: min(380px, 100%); }
  .panel-pane.show { transform: none; }
}
@media (min-width: 1280px) { .panel-pane.collapsed { display: none; } }

@media (max-width: 860px) {
  :root { --list: 100%; }
  .rail { display: none; }
  #app { flex-direction: column; }
  .main { flex: 1; min-height: 0; }
  .tabbar {
    display: flex; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(14px); border-top: 1px solid var(--line);
    padding: 4px 4px calc(4px + var(--safe-bottom)); z-index: 10;
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; font-size: 10.5px; font-weight: 650; color: var(--text-3); text-decoration: none; position: relative; border-radius: 12px; }
  .tabbar a.on { color: var(--brand); }
  .tabbar a .badge { position: absolute; top: 1px; left: calc(50% + 6px); height: 17px; min-width: 17px; font-size: 10px; border: 2px solid var(--surface); }
  body.in-chat .tabbar { display: none; }
  .inbox { position: relative; overflow: hidden; }
  .list-pane { width: 100%; border-right: 0; }
  .chat-pane { position: absolute; inset: 0; z-index: 20; transform: translateX(100%); transition: transform .24s cubic-bezier(.2,.8,.2,1); }
  .inbox.chat-open .chat-pane { transform: none; }
  .inbox.chat-open .list-pane { visibility: hidden; transition: visibility 0s .24s; }
  .chat-head .back { display: inline-grid; }
  .chat-head .hide-m { display: none; }
  .bubble { max-width: 86%; }
  .msg .actions { display: none !important; }
  .messages { padding: 10px 10px 8px; }
  .page-head { padding: calc(14px + var(--safe-top)) 16px 10px; }
  .page-head h1 { font-size: 22px; }
  .page-body { padding: 4px 16px calc(24px + var(--safe-bottom)); }
  .tabs-line { margin: 0 16px; }
  .modal-back { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; animation: sheet .24s cubic-bezier(.2,.8,.2,1); }
  .modal.wide { width: 100%; }
  @keyframes sheet { from { transform: translateY(100%); } }
  .modal-head::before { content: ""; position: absolute; left: 50%; transform: translateX(-50%); top: 6px; width: 38px; height: 4px; border-radius: 4px; background: var(--line-2); }
  .modal-head { position: relative; padding-top: 20px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi b { font-size: 22px; }
  .hide-m { display: none !important; }
  .table .hide-m { display: none; }
  .composer textarea { font-size: 16px; } /* avoid iOS zoom */
  .demo-banner .long { display: none; }
  .chat-head .who small .ellipsis { max-width: 110px; }
  .input, .select, .textarea { font-size: 16px; }
}
@media (min-width: 861px) { .show-m { display: none !important; } }

/* ---------------------------------------------------------------- v1.3 additions */
/* Chat header: the name must keep its space when the category/subject chips and the
   assignment controls are present. */
.chat-head .who > .row { min-width: 0; }
.chat-head .who > .row > b { flex: 0 1 auto; min-width: 0; }
.chat-head .cat-chip, .chat-head .chip { flex: none; }
.chat-head .chip { height: 32px; }
@media (max-width: 1500px) { .chat-head .who .cat-chip:nth-of-type(2) { display: none; } }

/* Filter chips scroll sideways rather than wrapping into a tall block */
.chips { overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

/* Order cards in the contact panel */
.panel-body .card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.panel-body .quick { display: flex; gap: 6px; flex-wrap: wrap; }
.panel-body .quick a, .panel-body .quick button {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text-2); cursor: pointer;
}
.panel-body .quick a:hover, .panel-body .quick button:hover { color: var(--text); border-color: var(--text-3); }

/* Simple proportion / progress bar used by the reports and the storage card */
.bar-track { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; display: flex; }
.bar-track > span { display: block; height: 100%; }

/* Sticky order strip under the chat header */
.order-bar {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 12.5px;
  color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--line); z-index: 2;
}
.order-bar.hidden { display: none; }
.order-bar button, .order-bar a {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 7px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); cursor: pointer;
}
.order-bar button:hover, .order-bar a:hover { color: var(--text); }
.label.who-sent { color: var(--text-3); font-size: 11.5px; font-weight: 650; display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }

/* ---------------------------------------------------------------- Catalogue screen
   Inner tab strip, product cards, the editable size/variant rows and the "try it" result. */
.subtabs { display: inline-flex; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 650; color: var(--text-3); white-space: nowrap; flex: none; }
.subtabs button:hover { color: var(--text-2); }
.subtabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

.prod { display: flex; align-items: center; gap: 12px; padding: 12px; cursor: pointer; }
.prod:hover { border-color: var(--text-3); }
.prod-img { width: 54px; height: 68px; flex: none; border-radius: 9px; object-fit: cover; background: var(--surface-3); }
.prod-img.ph { display: grid; place-items: center; color: var(--text-3); }
.chip.xs { height: 22px; padding: 0 8px; font-size: 11.5px; }

.input.sm { height: 34px; padding: 0 9px; font-size: 13px; }
.vrow { display: grid; grid-template-columns: 1.4fr 1fr 74px 84px 34px; gap: 6px; align-items: center; }
@media (max-width: 640px) { .vrow { grid-template-columns: 1fr 1fr 34px; } }
.vrow.head span { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding-left: 2px; }

.trybox { margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.bigsize { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.evidence { margin: 10px 0 0; font-size: 13px; color: var(--text-2); white-space: pre-line; }
