/* Dispop — components.css. Shared UI primitives. Requires tokens.css. */

/* ---------- Layout helpers ---------- */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-6 { gap: var(--s-6); }
.gap-8 { gap: var(--s-8); }
.flex-1 { flex: 1 1 auto; min-width: 0; }
.center { display: flex; align-items: center; justify-content: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--muted); }
.tabular { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.mono { font-family: var(--font-mono); }

/* ---------- Typography ---------- */
.h1 { font-family: var(--font-display); font-weight: 700; font-size: var(--t-4xl); letter-spacing: -0.02em; line-height: 1.15; }
.h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--t-3xl); letter-spacing: -0.015em; line-height: 1.2; }
.h3 { font-family: var(--font-display); font-weight: 600; font-size: var(--t-2xl); letter-spacing: -0.01em; line-height: 1.25; }
.h4 { font-weight: 600; font-size: var(--t-xl); letter-spacing: -0.005em; line-height: 1.3; }
.eyebrow { font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.kicker { font-family: var(--font-mono); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.caption { font-size: var(--t-sm); color: var(--muted); }
.metric { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Logo (Dispop bubble) ---------- */
.dispop-logo {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em;
  color: var(--fg-strong);
}
.dispop-mark {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  position: relative;
  flex: none;
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.18), 0 6px 14px -6px var(--accent-soft);
}
.dispop-mark::after {
  content: ""; position: absolute;
  width: 10px; height: 10px; border-radius: 50% 50% 50% 4px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  bottom: -3px; right: -3px;
  box-shadow: 0 2px 6px -2px oklch(0% 0 0 / 0.4);
}
.dispop-mark.lg { width: 56px; height: 56px; border-radius: 16px; }
.dispop-mark.lg::after { width: 20px; height: 20px; border-radius: 50% 50% 50% 8px; bottom: -6px; right: -6px; }
.dispop-mark.xl { width: 88px; height: 88px; border-radius: 22px; }
.dispop-mark.xl::after { width: 28px; height: 28px; border-radius: 50% 50% 50% 10px; bottom: -8px; right: -8px; }

/* ---------- Buttons ---------- */
.btn {
  --bh: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--bh);
  padding: 0 var(--s-4);
  border-radius: var(--r-md);
  font: inherit; font-weight: 600; font-size: var(--t-base);
  border: 1px solid transparent;
  background: transparent; color: var(--fg);
  cursor: pointer;
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease), transform var(--d-fast) var(--ease);
  user-select: none;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(0.5px); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn .icon { width: 18px; height: 18px; }
.btn.sm { --bh: 30px; padding: 0 var(--s-3); font-size: var(--t-sm); border-radius: var(--r-sm); }
.btn.lg { --bh: 44px; padding: 0 var(--s-5); font-size: var(--t-lg); border-radius: var(--r-lg); }
.btn.full { width: 100%; }

.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.secondary { border-color: var(--border-strong); color: var(--fg); background: transparent; }
.btn.secondary:hover { background: var(--hover); }
.btn.ghost { color: var(--muted); }
.btn.ghost:hover { color: var(--fg); background: var(--hover); }
.btn.danger { background: var(--danger); color: oklch(99% 0.003 25); }
.btn.danger:hover { filter: brightness(1.06); }
.btn.danger.outline { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger.outline:hover { background: oklch(60% 0.18 25 / 0.12); }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); border: 0; cursor: pointer;
  transition: all var(--d-fast) var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn.active { background: var(--accent-soft); color: var(--fg-strong); }
.icon-btn.lg { width: 44px; height: 44px; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn .icon { width: 20px; height: 20px; }

.chip-btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 28px; padding: 0 var(--s-3); border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--fg);
  border: 1px solid var(--border);
  font-size: var(--t-sm); font-weight: 500;
  cursor: pointer;
}
.chip-btn:hover { background: var(--hover); }
.chip-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--fg-strong); }

/* round call buttons */
.round-btn {
  width: 56px; height: 56px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--fg); border: 0; cursor: pointer;
  transition: all var(--d-fast) var(--ease);
}
.round-btn .icon { width: 22px; height: 22px; }
.round-btn:hover { background: var(--hover); }
.round-btn.accept { background: var(--success); color: oklch(99% 0.003 155); }
.round-btn.decline { background: var(--danger); color: oklch(99% 0.003 25); }
.round-btn.lg { width: 64px; height: 64px; }
.round-btn.lg .icon { width: 26px; height: 26px; }

/* ---------- Inputs ---------- */
.input, .textarea, .select {
  width: 100%;
  height: 38px;
  padding: 0 var(--s-3);
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font: inherit;
  transition: border-color var(--d-fast) var(--ease), background var(--d-fast) var(--ease);
}
.textarea { height: auto; min-height: 90px; padding: var(--s-3); resize: vertical; line-height: 1.5; }
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input.lg { height: 44px; padding: 0 var(--s-4); border-radius: var(--r-lg); font-size: var(--t-lg); }

.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field-label { font-size: var(--t-sm); font-weight: 600; color: var(--fg); }
.field-help { font-size: var(--t-xs); color: var(--muted); }
.field-error { font-size: var(--t-xs); color: var(--danger); }

.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 36px; }

/* range */
.range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: var(--r-pill);
  background: var(--border); outline: none;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 0 0 4px var(--bg);
  border: 0;
}
.range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 0;
}

/* switch */
.switch {
  position: relative; display: inline-block;
  width: 36px; height: 22px;
  background: var(--border); border-radius: var(--r-pill);
  cursor: pointer; flex: none;
  transition: background var(--d-base) var(--ease);
}
.switch::after {
  content: ""; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); top: 2px; left: 2px;
  transition: transform var(--d-base) var(--ease);
  box-shadow: 0 1px 3px oklch(0% 0 0 / 0.3);
}
.switch[data-on="true"] { background: var(--accent); }
.switch[data-on="true"]::after { transform: translateX(14px); background: oklch(99% 0.003 250); }

/* segmented */
.segment {
  display: inline-flex; padding: 3px;
  background: var(--surface-2); border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.segment > button {
  height: 28px; padding: 0 var(--s-3);
  border: 0; background: transparent;
  border-radius: var(--r-sm);
  color: var(--muted); font: inherit; font-size: var(--t-sm); font-weight: 500;
  cursor: pointer;
}
.segment > button.active { background: var(--surface); color: var(--fg-strong); box-shadow: var(--shadow-1); }

/* tabs */
.tabs { display: inline-flex; gap: 0; padding: 4px; background: var(--surface-2); border-radius: var(--r-lg); border: 1px solid var(--border); }
.tabs > button {
  height: 32px; padding: 0 var(--s-4);
  border: 0; background: transparent;
  border-radius: var(--r-md);
  color: var(--muted); font: inherit; font-weight: 600; font-size: var(--t-sm);
  cursor: pointer;
}
.tabs > button.active { background: var(--surface); color: var(--fg-strong); box-shadow: var(--shadow-1); }

/* ---------- Avatar ---------- */
.avatar {
  --as: 40px;
  width: var(--as); height: var(--as);
  border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, oklch(60% 0.06 220), oklch(45% 0.08 280));
  color: oklch(98% 0.003 250);
  font-weight: 600; font-size: calc(var(--as) * 0.4);
  position: relative;
  overflow: hidden;
  user-select: none;
}
.avatar.sm { --as: 28px; }
.avatar.md { --as: 40px; }
.avatar.lg { --as: 56px; }
.avatar.xl { --as: 96px; }
.avatar.xxl { --as: 120px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.gradient-1 { background: linear-gradient(135deg, oklch(60% 0.18 250), oklch(50% 0.18 295)); }
.avatar.gradient-2 { background: linear-gradient(135deg, oklch(70% 0.14 155), oklch(60% 0.14 200)); }
.avatar.gradient-3 { background: linear-gradient(135deg, oklch(70% 0.16 50), oklch(60% 0.18 25)); }
.avatar.gradient-4 { background: linear-gradient(135deg, oklch(70% 0.16 350), oklch(50% 0.18 320)); }
.avatar.gradient-5 { background: linear-gradient(135deg, oklch(60% 0.14 200), oklch(45% 0.10 240)); }
.avatar.gradient-6 { background: linear-gradient(135deg, oklch(72% 0.13 90), oklch(58% 0.14 60)); }

.avatar .dot {
  position: absolute; right: 0; bottom: 0;
  width: 28%; height: 28%; min-width: 8px; min-height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2.5px var(--surface);
}
.avatar .dot.away { background: var(--warn); }
.avatar .dot.busy { background: var(--danger); }
.avatar .dot.offline { background: var(--muted-2); }

.avatar .status-badge {
  position: absolute; right: -2px; bottom: -2px;
  width: 32%; min-width: 16px;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border-radius: 50%;
  font-size: 10px;
  border: 2px solid var(--bg);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-fg);
  font-size: var(--t-xs); font-weight: 700; font-variant-numeric: tabular-nums;
  flex: none;
}
.badge.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.dot { min-width: 8px; height: 8px; padding: 0; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: var(--t-xs); font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.tag.accent { background: var(--accent-soft); border-color: var(--accent); color: var(--fg-strong); }

.pill {
  display: inline-flex; align-items: center; gap: var(--s-1);
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: var(--t-xs); font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.pill.success { background: oklch(50% 0.13 155 / 0.18); color: var(--success); border-color: oklch(50% 0.13 155 / 0.4); }
.pill.warn    { background: oklch(60% 0.14 80  / 0.18); color: var(--warn);    border-color: oklch(60% 0.14 80  / 0.4); }
.pill.danger  { background: oklch(56% 0.18 25  / 0.18); color: var(--danger);  border-color: oklch(56% 0.18 25  / 0.4); }
.pill.info    { background: oklch(56% 0.10 230 / 0.18); color: var(--info);    border-color: oklch(56% 0.10 230 / 0.4); }

/* ---------- Card / Surface ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s-5);
}
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.divider-v { width: 1px; align-self: stretch; background: var(--border); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: oklch(0% 0 0 / 0.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: var(--z-modal);
  padding: var(--s-6);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  width: 100%; max-width: 520px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 48px);
  overflow: hidden;
}
.modal.lg { max-width: 880px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-5) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.modal-title { font-weight: 600; font-size: var(--t-xl); letter-spacing: -0.005em; }
.modal-body { padding: var(--s-5); overflow: auto; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex: none;
}

/* ---------- Toast ---------- */
.toast {
  display: inline-flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  min-width: 280px; max-width: 420px;
}
.toast .icon { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.toast.success .icon { color: var(--success); }
.toast.error .icon { color: var(--danger); }
.toast.info .icon { color: var(--info); }

/* ---------- Context menu ---------- */
.menu {
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  padding: 6px;
  min-width: 200px;
}
.menu-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 8px 10px; border-radius: var(--r-sm);
  font-size: var(--t-sm); color: var(--fg);
  cursor: pointer; user-select: none;
}
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--danger); }
.menu-item .icon { width: 16px; height: 16px; color: var(--muted); }
.menu-item.danger .icon { color: var(--danger); }
.menu-item .kbd { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }

/* ---------- Skeleton ---------- */
.skel {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--hover) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: skel 1.4s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Empty state ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: var(--s-10) var(--s-6);
  color: var(--muted);
}
.empty-illu {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-2);
  margin-bottom: var(--s-4);
  border: 1px solid var(--border);
}
.empty-illu .icon { width: 36px; height: 36px; }
.empty-title { font-weight: 600; font-size: var(--t-lg); color: var(--fg); margin-bottom: var(--s-2); }
.empty-text { font-size: var(--t-sm); max-width: 280px; }

/* ---------- Bubble (chat message) ---------- */
.msg-row {
  display: flex; gap: var(--s-2); align-items: flex-end;
  padding: 2px 0;
}
.msg-row.mine { justify-content: flex-end; }
.msg-stack { display: flex; flex-direction: column; gap: 2px; max-width: 70%; }
.msg-stack.mine { align-items: flex-end; }

.bubble {
  position: relative;
  padding: 8px 12px 6px;
  background: var(--bub-them-bg);
  color: var(--bub-them-fg);
  border-radius: 16px 16px 16px 4px;
  font-size: var(--t-base);
  line-height: 1.4;
  box-shadow: var(--shadow-1);
  word-wrap: break-word;
}
.msg-row.mine .bubble {
  background: var(--bub-mine-bg);
  color: var(--bub-mine-fg);
  border-radius: 16px 16px 4px 16px;
}
.bubble .meta {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: 8px;
  font-size: var(--t-xs); color: var(--muted);
  font-variant-numeric: tabular-nums;
  vertical-align: baseline;
}
.msg-row.mine .bubble .meta { color: oklch(99% 0.003 250 / 0.7); }
.bubble .body { display: inline; }
.bubble .check { width: 14px; height: 14px; }
.bubble .edited { font-style: italic; }
.bubble.image { padding: 4px; max-width: 320px; }
.bubble.image img, .bubble.image .img-stub { display: block; border-radius: 12px; width: 100%; }
.bubble.image .meta-overlay {
  position: absolute; right: 8px; bottom: 8px;
  background: oklch(0% 0 0 / 0.5); color: oklch(99% 0.003 250);
  padding: 2px 8px; border-radius: var(--r-pill);
  font-size: var(--t-xs); font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; gap: 4px;
  backdrop-filter: blur(4px);
}
.bubble.sticker { background: transparent !important; box-shadow: none !important; padding: 0 !important; border-radius: 0; }
.bubble.deleted { font-style: italic; color: var(--muted); background: var(--surface-2) !important; border: 1px dashed var(--border); }

.reply-quote {
  display: flex; gap: 8px; padding: 6px 8px; margin-bottom: 6px;
  border-left: 3px solid var(--accent-strong);
  background: oklch(0% 0 0 / 0.16);
  border-radius: 6px;
  font-size: var(--t-sm);
}
.msg-row.mine .reply-quote { background: oklch(100% 0 0 / 0.12); border-left-color: oklch(100% 0 0 / 0.7); }
.reply-quote-name { font-weight: 600; }
.reply-quote-text { color: var(--muted); }
.msg-row.mine .reply-quote-text { color: oklch(99% 0.003 250 / 0.8); }

.reactions {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-top: 4px;
}
.rxn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: var(--t-xs); font-weight: 600; color: var(--fg);
}
.rxn.mine { background: var(--accent-soft); border-color: var(--accent); }
.rxn .count { font-variant-numeric: tabular-nums; color: var(--muted); }
.rxn.mine .count { color: var(--fg-strong); }

/* voice */
.voice {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px;
}
.voice-play {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center; flex: none;
  border: 0; cursor: pointer;
}
.msg-row:not(.mine) .voice-play { background: var(--accent); }
.msg-row.mine .voice-play { background: oklch(100% 0 0 / 0.18); }
.voice-wave { display: flex; align-items: center; gap: 2px; height: 24px; flex: 1; }
.voice-wave i {
  display: inline-block; width: 2px; border-radius: 1px;
  background: var(--muted);
}
.msg-row.mine .voice-wave i { background: oklch(100% 0 0 / 0.6); }
.voice-wave i.played { background: var(--accent-strong); }
.msg-row.mine .voice-wave i.played { background: oklch(100% 0 0); }
.voice-time { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--muted); min-width: 40px; }
.msg-row.mine .voice-time { color: oklch(99% 0.003 250 / 0.8); }

/* circle */
.circle {
  width: 240px; height: 240px; border-radius: 50%;
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, oklch(40% 0.05 240), oklch(28% 0.04 240));
  display: flex; align-items: flex-end; justify-content: flex-start;
  box-shadow: var(--shadow-2);
}
.circle .play-cover {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: oklch(99% 0.003 250);
  background: oklch(0% 0 0 / 0.2);
}
.circle .play-cover .icon { width: 44px; height: 44px; }
.circle .ring {
  position: absolute; inset: 0;
  pointer-events: none;
}
.circle .meta-overlay {
  position: absolute; left: 12px; bottom: 12px;
  background: oklch(0% 0 0 / 0.55); color: oklch(99% 0.003 250);
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: var(--t-xs); font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 4px;
  backdrop-filter: blur(4px);
}

/* sticker */
.sticker-img {
  width: 156px; height: 156px;
  display: flex; align-items: center; justify-content: center;
  font-size: 100px;
  filter: drop-shadow(0 4px 14px oklch(0% 0 0 / 0.3));
}

/* ---------- Image stub ---------- */
.img-stub {
  background:
    linear-gradient(135deg, oklch(50% 0.10 220), oklch(35% 0.08 280)),
    var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: oklch(99% 0.003 250);
  width: 100%; aspect-ratio: 4 / 3;
}
.img-stub.tall { aspect-ratio: 3 / 4; }
.img-stub.wide { aspect-ratio: 16 / 9; }
.img-stub.square { aspect-ratio: 1 / 1; }
.img-stub .icon { width: 32px; height: 32px; opacity: 0.6; }

/* ---------- Conversation list row ---------- */
.conv {
  display: flex; gap: var(--s-3); padding: 10px var(--s-4);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: background var(--d-fast) var(--ease);
  align-items: center;
}
.conv:hover { background: var(--hover); }
.conv.active { background: var(--accent-soft); }
.conv .conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv .conv-top { display: flex; align-items: center; gap: var(--s-2); }
.conv .conv-name { font-weight: 600; font-size: var(--t-base); color: var(--fg-strong); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .conv-time { font-size: var(--t-xs); color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.conv .conv-bottom { display: flex; align-items: center; gap: var(--s-2); }
.conv .conv-preview { flex: 1; min-width: 0; font-size: var(--t-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.conv .conv-preview .icon { width: 14px; height: 14px; flex: none; color: var(--muted-2); }
.conv .conv-preview.typing { color: var(--accent-strong); font-style: italic; }
.conv.active .conv-name, .conv.active .conv-time { color: var(--fg-strong); }
.conv.active .conv-preview { color: var(--fg); }

/* ---------- Composer ---------- */
.composer {
  display: flex; align-items: flex-end; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.composer-input {
  flex: 1;
  min-height: 40px; max-height: 120px;
  padding: 10px 14px;
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  font: inherit; font-size: var(--t-base);
  resize: none;
  line-height: 1.4;
}
.composer-input:focus { outline: none; border-color: var(--accent); }
.composer-input::placeholder { color: var(--muted-2); }

.reply-bar {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 8px 14px;
  background: var(--surface-2); border-top: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
.reply-bar .icon { color: var(--accent); width: 18px; height: 18px; flex: none; }
.reply-bar-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.reply-bar-name { font-size: var(--t-xs); font-weight: 600; color: var(--accent); }
.reply-bar-text { font-size: var(--t-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Tooltip ---------- */
.tip { position: relative; }
.tip[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--elev); color: var(--fg); border: 1px solid var(--border);
  padding: 4px 8px; border-radius: var(--r-sm);
  font-size: var(--t-xs); white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity var(--d-fast) var(--ease);
  z-index: var(--z-toast);
}
.tip:hover::after { opacity: 1; }

/* ---------- Sticky page header (used in ui-kit) ---------- */
.page-header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-6);
  background: oklch(from var(--bg) l c h / 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

/* ---------- Mobile bottom tab-bar ---------- */
.tabbar {
  display: flex; justify-content: space-around; align-items: stretch;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabbar > a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0;
  color: var(--muted);
  font-size: var(--t-xs); font-weight: 500;
  position: relative;
  text-decoration: none;
}
.tabbar > a .icon { width: 22px; height: 22px; }
.tabbar > a.active { color: var(--accent-strong); }
.tabbar > a .badge { position: absolute; top: 2px; right: 50%; transform: translateX(14px); }
