/* whats — support chat UI. Mobile first; two panes at >= 900px. */

:root {
  color-scheme: light dark;

  --app-bg: #f0f2f5;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --panel-hover: #f0f2f5;
  --panel-active: #e9edef;

  --chat-bg: #efe7dd;
  --pattern: rgba(17, 27, 33, 0.05);
  --pattern-2: rgba(17, 27, 33, 0.028);

  --text: #111b21;
  --text-dim: #667781;
  --text-faint: #8696a0;

  --border: #e9edef;
  --divider: #d8dde0;

  --accent: #00a884;
  --accent-strong: #008069;
  --accent-ink: #ffffff;

  --bubble-out: #d9fdd3;
  --bubble-in: #ffffff;
  --bubble-ink: #111b21;

  --quote-bg: rgba(11, 20, 26, 0.06);
  --quote-bar: #06cf9c;
  --quote-bar-in: #53bdeb;

  --tick: #8696a0;
  --tick-read: #53bdeb;

  --badge: #25d366;
  --badge-ink: #0b3d24;
  --danger: #d1373c;
  --warn: #b26b00;

  --shadow-1: 0 1px 2px rgba(11, 20, 26, 0.13);
  --shadow-2: 0 8px 28px rgba(11, 20, 26, 0.22);

  --radius: 14px;
  --radius-sm: 8px;
  --head-h: 60px;
  --list-w: 32%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --app-bg: #111b21;
    --panel: #111b21;
    --panel-2: #202c33;
    --panel-hover: #202c33;
    --panel-active: #2a3942;

    --chat-bg: #0b141a;
    --pattern: rgba(233, 237, 239, 0.05);
    --pattern-2: rgba(233, 237, 239, 0.026);

    --text: #e9edef;
    --text-dim: #8696a0;
    --text-faint: #667781;

    --border: #222d34;
    --divider: #2a3942;

    --accent: #00a884;
    --accent-strong: #00a884;
    --accent-ink: #111b21;

    --bubble-out: #005c4b;
    --bubble-in: #202c33;
    --bubble-ink: #e9edef;

    --quote-bg: rgba(255, 255, 255, 0.08);

    --badge: #00a884;
    --badge-ink: #0b141a;
    --danger: #f15c6d;
    --warn: #e0a33c;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.56);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--app-bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button, input, textarea { font: inherit; color: inherit; }

a { color: var(--accent-strong); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- icons */

.icon {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-fill {
  fill: currentColor;
  stroke: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.icon-btn:hover { background: var(--panel-hover); color: var(--text); }
.icon-btn:active { background: var(--panel-active); }

/* ---------------------------------------------------------------- layout */

.layout {
  display: flex;
  height: 100dvh;
  min-height: 100dvh;
  background: var(--panel);
}

.side {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  background: var(--panel);
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.pane-list {
  flex: 1;
  min-height: 0;
}

.pane-new {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: var(--panel);
}

.pane-conv {
  display: none;
  flex: 1;
  min-width: 0;
  position: relative;
  background: var(--chat-bg);
}

body.show-conv .side { display: none; }
body.show-conv .pane-conv { display: flex; }

@media (min-width: 900px) {
  .side {
    display: flex !important;
    width: var(--list-w);
    min-width: 320px;
    max-width: 480px;
    border-right: 1px solid var(--divider);
  }
  .pane-conv { display: flex !important; }
  .back-btn { display: none !important; }
}

/* ---------------------------------------------------------------- headers */

.pane-head {
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--head-h);
  flex: none;
  padding: 0 8px 0 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}

.pane-head .me {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.me-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-role {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: capitalize;
}

.me-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.pane-title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- avatars */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #ffffff;
  background: #6b7c85;
  user-select: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 34px; height: 34px; font-size: 13px; }
.avatar-xs { width: 26px; height: 26px; font-size: 11px; }

.av-0 { background: #d9737a; }
.av-1 { background: #c6822f; }
.av-2 { background: #4a9f6b; }
.av-3 { background: #3f8fa8; }
.av-4 { background: #7a74c4; }
.av-5 { background: #b3679e; }
.av-6 { background: #5c8d3f; }
.av-7 { background: #9a6b4f; }

/* ---------------------------------------------------------------- banners */

.conn-banner {
  flex: none;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--badge-ink);
  background: var(--warn);
  color: #ffffff;
}

.conn-banner.offline { background: var(--danger); }

/* ---------------------------------------------------------------- tabs */

.tabs {
  display: flex;
  flex: none;
  gap: 2px;
  padding: 6px 8px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 1 0 auto;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover { background: var(--panel-hover); }

.tab[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ---------------------------------------------------------------- chat list */

.chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel);
}

.chat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.chat-row:hover { background: var(--panel-hover); }
.chat-row[aria-current="true"] { background: var(--panel-active); }

.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-top, .chat-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-time {
  flex: none;
  font-size: 12px;
  color: var(--text-dim);
}

.chat-row.unread .chat-time { color: var(--accent-strong); }

.chat-preview {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-preview .preview-ticks { margin-right: 3px; vertical-align: -2px; }

.badge {
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--badge);
  color: var(--badge-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.chat-tag {
  flex: none;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  background: var(--panel-active);
}

.list-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

/* ---------------------------------------------------------------- new chat */

.dir-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 24px;
}

.dir-group-title {
  margin: 0;
  padding: 16px 16px 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.dir-list { list-style: none; margin: 0; padding: 0; }

.dir-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.dir-row:hover { background: var(--panel-hover); }

.dir-text { display: flex; flex-direction: column; min-width: 0; }

.dir-name {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dir-sub {
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- conversation */

.conv-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  background: var(--app-bg);
}

.conv {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;
}

.conv-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  height: var(--head-h);
  padding: 0 8px 0 10px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 4;
}

.conv-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.25;
}

.conv-name {
  font-size: 16px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 16px;
}

.conv-sub.typing { color: var(--accent-strong); }

.conv-chip {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--panel-active);
  color: var(--text-dim);
}

/* message area + CSS-drawn background pattern */

.msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 4% 8px;
  background-color: var(--chat-bg);
  background-image:
    radial-gradient(var(--pattern) 1.1px, transparent 1.2px),
    radial-gradient(var(--pattern-2) 1.1px, transparent 1.2px),
    repeating-linear-gradient(135deg, var(--pattern-2) 0 1px, transparent 1px 46px);
  background-size: 34px 34px, 34px 34px, auto;
  background-position: 0 0, 17px 17px, 0 0;
}

.msgs-top {
  display: flex;
  justify-content: center;
  min-height: 4px;
  padding: 4px 0;
}

.msgs-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--pattern);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
}

/* separators */

.sep {
  display: flex;
  justify-content: center;
  margin: 12px 0 6px;
}

.sep span {
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  box-shadow: var(--shadow-1);
  font-size: 12.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.sep.unread span {
  background: var(--accent);
  color: var(--accent-ink);
  text-transform: none;
  letter-spacing: 0;
}

.sys-row { display: flex; justify-content: center; margin: 6px 0; }

.sys-row .sys {
  max-width: 80%;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  box-shadow: var(--shadow-1);
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

/* bubbles */

.row {
  display: flex;
  padding: 1px 0;
}

.row.out { justify-content: flex-end; }
.row.in { justify-content: flex-start; }
.row.grp-first { margin-top: 8px; }

.bubble {
  position: relative;
  max-width: min(76%, 560px);
  min-width: 92px;
  padding: 6px 9px 7px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  color: var(--bubble-ink);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.row.in .bubble { background: var(--bubble-in); border-top-left-radius: var(--radius); }
.row.out .bubble { background: var(--bubble-out); }

.row.grp-first.in .bubble { border-top-left-radius: 4px; }
.row.grp-first.out .bubble { border-top-right-radius: 4px; }

/* tail */
.row.grp-first .bubble::after {
  content: "";
  position: absolute;
  top: 0;
  width: 9px;
  height: 14px;
}

.row.grp-first.in .bubble::after {
  left: -8px;
  background: var(--bubble-in);
  clip-path: polygon(100% 0, 100% 100%, 0 0);
}

.row.grp-first.out .bubble::after {
  right: -8px;
  background: var(--bubble-out);
  clip-path: polygon(0 0, 0 100%, 100% 0);
}

.row.highlight .bubble {
  animation: flash 1.4s ease-out;
}

@keyframes flash {
  0%, 40% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: var(--shadow-1); }
}

.sender {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-strong);
}

.body {
  white-space: pre-wrap;
  font-size: 14.8px;
  line-height: 1.35;
}

.body a { word-break: break-all; }

.body .deleted {
  color: var(--text-dim);
  font-style: italic;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin: 2px 0 -2px auto;
  font-size: 11px;
  color: var(--text-dim);
  user-select: none;
}

.meta .edited { font-style: italic; }

.ticks { display: inline-flex; width: 16px; height: 14px; }
.ticks .icon { width: 16px; height: 14px; stroke-width: 2; }
.ticks.read { color: var(--tick-read); }
.ticks.failed { color: var(--danger); }

.quote {
  display: block;
  width: 100%;
  margin: 0 0 4px;
  padding: 5px 8px;
  border: 0;
  border-left: 4px solid var(--quote-bar);
  border-radius: 6px;
  background: var(--quote-bg);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.row.in .quote { border-left-color: var(--quote-bar-in); }

.quote-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--quote-bar);
}

.row.in .quote-name { color: var(--quote-bar-in); }

.quote-text {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin: 5px 0 -2px;
}

.reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

.reaction.mine { border-color: var(--accent); }

.chev {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 26px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
}

.chev .icon { width: 18px; height: 18px; }

.bubble:hover .chev, .chev:focus-visible { opacity: 1; }

@media (pointer: coarse) {
  .chev { display: none; }
}

.fail-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--danger);
}

.retry-btn {
  padding: 2px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  cursor: pointer;
}

/* jump to latest */

.jump-btn {
  position: absolute;
  right: 16px;
  bottom: 84px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text-dim);
  box-shadow: var(--shadow-2);
  cursor: pointer;
}

.jump-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--badge);
  color: var(--badge-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
}

/* ---------------------------------------------------------------- composer */

.composer {
  position: relative;
  flex: none;
  padding: 6px 8px 8px;
  background: var(--panel-2);
  border-top: 1px solid var(--border);
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.compose-context {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 6px;
  padding: 6px 6px 6px 0;
  border-left: 4px solid var(--quote-bar);
  border-radius: 6px;
  background: var(--panel);
}

.compose-context .ctx-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-left: 8px;
}

.ctx-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--quote-bar);
}

.ctx-text {
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compose-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.compose-input {
  flex: 1;
  min-width: 0;
  max-height: 148px;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  resize: none;
  overflow-y: auto;
  line-height: 1.35;
}

.compose-input::placeholder { color: var(--text-faint); }

.send-btn {
  background: var(--accent);
  color: var(--accent-ink);
}

.send-btn:hover { background: var(--accent-strong); color: var(--accent-ink); }

/* emoji picker */

.emoji-panel {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% - 4px);
  max-width: 360px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-2);
  z-index: 8;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 2px;
}

.emoji-btn {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.emoji-btn:hover { background: var(--panel-hover); }

/* ---------------------------------------------------------------- menu */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: transparent;
}

.menu {
  position: fixed;
  z-index: 50;
  min-width: 188px;
  max-width: 260px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-2);
}

.menu-react {
  display: flex;
  gap: 2px;
  padding: 2px 2px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.menu-react .emoji-btn { width: 34px; aspect-ratio: 1; font-size: 20px; }

.menu-items { list-style: none; margin: 0; padding: 0; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-size: 14.5px;
  cursor: pointer;
}

.menu-item:hover { background: var(--panel-hover); }
.menu-item.danger { color: var(--danger); }

/* ---------------------------------------------------------------- login */

.page-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 16px;
  background: var(--app-bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 28px 24px 24px;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-2);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 20px;
  font-weight: 700;
}

.login-brand .icon { width: 28px; height: 28px; }

.login-lead {
  margin: 0 0 20px;
  color: var(--text-dim);
  font-size: 14px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--divider);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { background: var(--panel-hover); }

.btn-primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover { background: var(--accent-strong); color: var(--accent-ink); }
.btn[disabled] { opacity: 0.6; cursor: default; }

.or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--text-faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.or::before, .or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--divider);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
}

.field input:focus { border-color: var(--accent); }

.form-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(209, 55, 60, 0.12);
  color: var(--danger);
  font-size: 13.5px;
}

.login-foot {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  transform: translateX(-50%);
  max-width: 88vw;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  box-shadow: var(--shadow-2);
  font-size: 14px;
}

/* Guest sign-in: the name field and its availability feedback. */
.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.field-status {
  margin: 4px 0 0;
  font-size: 12px;
  min-height: 16px;
  color: var(--text-dim);
}

.field-status[data-kind="ok"] { color: var(--accent); }
.field-status[data-kind="bad"] { color: var(--danger); }

/* The customer's sidebar always offers someone to talk to, so the chat list
   takes the space it needs and this section keeps the rest. */
.sidebar-dir {
  border-top: 1px solid var(--border);
  background: var(--panel);
  overflow-y: auto;
  flex: 0 1 auto;
  max-height: 55%;
}

.sidebar-dir-title {
  margin: 0;
  padding: 12px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  position: sticky;
  top: 0;
  background: var(--panel);
}

.sidebar-dir .dir-body { padding-bottom: 8px; }
.sidebar-dir .dir-group-title { padding-top: 8px; }

/* With chats present the list leads; with none, the directory does. */
.pane-list .chat-list { flex: 1 1 auto; }
