/* Batuni Web — design system (QR_WEB_DESIGN.md §6.7):
   Periwinkle #6E7CFF, Lilac #C9B8FF, Coral #FF7F6A, Cream #FFF7EE,
   Ink #1F2440, Mist #E8EAF4. Fonts: Poppins/Nunito with system
   fallbacks only — no external fonts (origin hygiene, §5.1). */
:root {
  --periwinkle: #6E7CFF;
  --lilac: #C9B8FF;
  --coral: #FF7F6A;
  --cream: #FFF7EE;
  --ink: #1F2440;
  --mist: #E8EAF4;
  --ink-soft: #5A5E7A;
  --white: #fff;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}
h1, h2, .wordmark { font-family: "Poppins", "Nunito", system-ui, sans-serif; }
button {
  font: inherit; cursor: pointer; border: none; border-radius: 999px;
  background: var(--periwinkle); color: #fff; padding: 10px 20px; font-weight: 700;
}
button.secondary { background: var(--mist); color: var(--ink); }
button.danger { background: var(--coral); }
button:disabled { opacity: .55; cursor: default; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 22px;
}
.logo {
  width: 38px; height: 38px; border-radius: 13px; background: var(--periwinkle);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 19px;
  font-family: "Poppins", system-ui, sans-serif;
}
.wordmark { font-weight: 600; font-size: 19px; }
.card {
  background: var(--white); border-radius: 24px; padding: 32px;
  box-shadow: 0 10px 30px rgba(31,36,64,.08); max-width: 560px; margin: 3vh auto; width: calc(100% - 40px);
}
.notice { background: #E4DEFF; border-radius: 14px; padding: 12px 14px; font-weight: 600; }
.warn { background: #FFE3DC; border-radius: 14px; padding: 12px 14px; font-weight: 600; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.qr-wrap { display: grid; place-items: center; margin: 18px 0 6px; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--coral); }
.status-line { min-height: 1.5em; font-weight: 700; }
[hidden] { display: none !important; }

/* ---- chats layout ---- */
.chats-layout { display: flex; height: calc(100vh - 66px); max-width: 1200px; margin: 0 auto; background: var(--white); border-radius: 20px 20px 0 0; overflow: hidden; box-shadow: 0 10px 30px rgba(31,36,64,.08); }
.sidebar { width: 340px; min-width: 280px; border-right: 1px solid var(--mist); display: flex; flex-direction: column; }
.sidebar-head { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-list { flex: 1; overflow-y: auto; }
.chat-row { display: flex; gap: 12px; padding: 12px 16px; cursor: pointer; border: none; background: none; width: 100%; text-align: left; border-radius: 0; color: var(--ink); font-weight: 400; }
.chat-row:hover { background: var(--cream); }
.chat-row.active { background: var(--mist); }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--lilac); color: var(--ink); display: grid; place-items: center; font-weight: 800; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-row-main { flex: 1; min-width: 0; }
.chat-row-top { display: flex; justify-content: space-between; gap: 8px; }
.chat-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.chat-preview { color: var(--ink-soft); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread { background: var(--periwinkle); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 800; padding: 1px 8px; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--mist); font-size: 14px; }
.pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pane-head { padding: 12px 18px; border-bottom: 1px solid var(--mist); display: flex; align-items: center; gap: 12px; }
.pane-head .sub { color: var(--ink-soft); font-size: 13px; }
.messages { flex: 1; overflow-y: auto; padding: 16px; background: var(--cream); display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 68%; padding: 9px 13px; border-radius: 16px; background: var(--white); box-shadow: 0 1px 3px rgba(31,36,64,.08); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-end; background: #DDE1FF; }
.bubble.theirs { align-self: flex-start; }
.bubble .meta { display: block; text-align: right; font-size: 11px; color: var(--ink-soft); margin-top: 3px; }
.bubble .ticks.read { color: var(--periwinkle); font-weight: 800; }
.bubble img.photo { max-width: 320px; width: 100%; border-radius: 12px; display: block; }
.quote { border-left: 3px solid var(--lilac); background: rgba(232,234,244,.7); border-radius: 8px; padding: 5px 8px; font-size: 13px; color: var(--ink-soft); margin-bottom: 5px; }
.system-chip { align-self: center; background: var(--mist); color: var(--ink-soft); font-size: 13px; padding: 4px 12px; border-radius: 999px; }
.banner { margin: 10px 16px 0; }
.composer { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--mist); background: var(--white); }
.composer textarea { flex: 1; font: inherit; border: 1px solid var(--mist); border-radius: 16px; padding: 10px 14px; resize: none; max-height: 120px; }
.send-error { color: var(--coral); font-weight: 700; padding: 0 16px 10px; }
.empty-state { margin: auto; text-align: center; color: var(--ink-soft); padding: 24px; }
@media (max-width: 760px) {
  .sidebar { width: 100%; }
  .pane { display: none; }
  .pane.open { display: flex; position: fixed; inset: 0; background: var(--white); z-index: 5; }
}
