:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #15202b;
  background: #eef3f7;
  --surface: #ffffff;
  --surface-2: #f5f8fa;
  --line: #e3e9ee;
  --primary: #176b87;
  --primary-soft: #dff3f8;
  --text-muted: #6b7a87;
  --mine: #d9f4e4;
  --theirs: #ffffff;
  --shadow: 0 18px 55px rgba(18, 42, 56, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #eef3f7; }
body { min-height: 100vh; }
button, input { font: inherit; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; }
.link-view {
  width: min(520px, calc(100% - 32px)); margin: 6vh auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 28px; padding: 34px; box-shadow: var(--shadow); text-align: center;
}
.brand-mark { width: 62px; height: 62px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center; font-size: 34px; background: var(--primary-soft); }
h1 { margin: 8px 0 4px; font-size: 28px; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.qr-card { width: 270px; height: 270px; margin: 28px auto 20px; border: 1px solid var(--line); border-radius: 24px; padding: 16px; position: relative; background: white; }
.qr-card img { width: 100%; height: 100%; display: block; }
.qr-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); }
.steps { text-align: left; line-height: 1.6; color: #3f4f5b; padding-left: 26px; }
.secondary-button, .send-button { border: 0; border-radius: 12px; cursor: pointer; }
.secondary-button { padding: 11px 16px; background: var(--surface-2); color: #20313e; }
.status-text { min-height: 20px; color: var(--text-muted); font-size: 13px; }
.chat-view { display: grid; grid-template-columns: 360px 1fr; height: 100vh; background: var(--surface); }
.sidebar { border-right: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; }
.sidebar-header, .conversation-header { height: 72px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: var(--surface); }
.eyebrow { color: var(--text-muted); font-size: 12px; margin-bottom: 3px; }
.icon-button { border: 0; width: 38px; height: 38px; border-radius: 12px; background: var(--surface-2); cursor: pointer; font-size: 20px; }
.conversation-list { overflow-y: auto; flex: 1; }
.conversation-item { display: grid; grid-template-columns: 48px 1fr auto; gap: 11px; padding: 13px 15px; cursor: pointer; border-bottom: 1px solid #f0f3f5; }
.conversation-item:hover, .conversation-item.active { background: #f3f8fa; }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.conversation-meta { min-width: 0; }
.conversation-meta strong, .conversation-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.conversation-preview { margin-top: 5px; color: var(--text-muted); font-size: 13px; }
.badge { min-width: 21px; height: 21px; padding: 0 6px; border-radius: 12px; background: var(--primary); color: white; display: grid; place-items: center; font-size: 11px; }
.conversation-pane { background: #f2f6f8; min-width: 0; }
.empty-state { height: 100%; display: grid; place-content: center; text-align: center; color: var(--text-muted); }
.empty-state h2 { color: #31424e; margin-bottom: 4px; }
.empty-icon { font-size: 48px; }
.active-conversation { height: 100%; display: flex; flex-direction: column; }
.conversation-header { justify-content: flex-start; gap: 12px; }
.message-list { flex: 1; overflow-y: auto; padding: 26px clamp(18px, 6vw, 80px); background: linear-gradient(rgba(242,246,248,.92), rgba(242,246,248,.92)), radial-gradient(circle at 30px 30px, #dbe6eb 1px, transparent 1px); background-size: auto, 22px 22px; }
.message-row { display: flex; margin: 5px 0; }
.message-row.mine { justify-content: flex-end; }
.bubble { max-width: min(650px, 76%); padding: 9px 12px 7px; border-radius: 16px 16px 16px 5px; background: var(--theirs); box-shadow: 0 1px 2px rgba(0,0,0,.05); white-space: pre-wrap; overflow-wrap: anywhere; }
.mine .bubble { background: var(--mine); border-radius: 16px 16px 5px 16px; }
.message-foot { display: flex; justify-content: flex-end; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; margin-top: 4px; }
.tick.seen { color: #1687c8; }
.composer { padding: 12px 16px; display: grid; grid-template-columns: 1fr auto; gap: 10px; background: var(--surface); border-top: 1px solid var(--line); }
.composer input { border: 1px solid var(--line); background: var(--surface-2); border-radius: 16px; padding: 13px 16px; outline: none; }
.composer input:focus { border-color: #8fb9c6; }
.send-button { padding: 0 20px; background: var(--primary); color: white; font-weight: 700; }
@media (max-width: 720px) {
  .chat-view { grid-template-columns: 1fr; }
  .sidebar { width: 100%; }
  .conversation-pane { display: none; }
}
@media (prefers-color-scheme: dark) {
  :root { color: #e7edf0; background: #0d1519; --surface: #152025; --surface-2: #1c2a30; --line: #2b3a41; --primary: #52bad6; --primary-soft: #173640; --text-muted: #91a3ad; --mine: #1f4a3a; --theirs: #1c2a30; --shadow: 0 18px 55px rgba(0,0,0,.35); }
  html,body { background:#0d1519; }
  .conversation-pane { background:#101a1f; }
  .message-list { background:#101a1f; }
  .steps { color:#c4d0d6; }
  .empty-state h2 { color:#d7e2e7; }
}
