/* SpamSpike console. One accent, system type, hairlines, continuous corners. */

:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-hover: #fafafb;
  --surface-press: #f2f2f4;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --sep: rgba(60, 60, 67, 0.18);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.08);
  --seg-on: #ffffff;
  --accent: #0071e3;
  --accent-tint: rgba(0, 113, 227, 0.08);
  --bar-bg: rgba(245, 245, 247, 0.74);
  --pop-bg: rgba(252, 252, 253, 0.86);
  --shadow-pop: 0 0 0 0.5px rgba(0, 0, 0, 0.1), 0 12px 32px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow-panel: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 24px 64px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.05);
  --mark: rgba(255, 204, 0, 0.4);
  --avatar: linear-gradient(180deg, #a5abb8 0%, #858a96 100%);

  /* Messages (light) */
  --t-bg: #ffffff;
  --t-text: #000000;
  --t-in: #e9e9eb;
  --t-in-press: #d9d9dc;
  --t-blue: #0a7cff;
  --t-green: #34c759;
  --t-stamp: #8a8a8e;
  --t-sep: rgba(60, 60, 67, 0.16);
  --t-glass: rgba(118, 118, 128, 0.14);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --r-card: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f10;
    --surface: #1c1c1e;
    --surface-hover: #212123;
    --surface-press: #262628;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #7c7c82;
    --sep: rgba(255, 255, 255, 0.1);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-2: rgba(118, 118, 128, 0.18);
    --seg-on: #636366;
    --accent: #0a84ff;
    --accent-tint: rgba(10, 132, 255, 0.16);
    --bar-bg: rgba(15, 15, 16, 0.72);
    --pop-bg: rgba(40, 40, 42, 0.84);
    --shadow-pop: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-panel: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 24px 64px rgba(0, 0, 0, 0.6);
    --mark: rgba(255, 214, 10, 0.32);
    --avatar: linear-gradient(180deg, #8e939f 0%, #6b6f7a 100%);
    --t-bg: #000000;
    --t-text: #ffffff;
    --t-in: #262628;
    --t-in-press: #3a3a3c;
    --t-blue: #0a84ff;
    --t-green: #30d158;
    --t-stamp: #8d8d93;
    --t-sep: rgba(255, 255, 255, 0.12);
    --t-glass: rgba(118, 118, 128, 0.3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f10;
  --surface: #1c1c1e;
  --surface-hover: #212123;
  --surface-press: #262628;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #7c7c82;
  --sep: rgba(255, 255, 255, 0.1);
  --fill: rgba(118, 118, 128, 0.24);
  --fill-2: rgba(118, 118, 128, 0.18);
  --seg-on: #636366;
  --accent: #0a84ff;
  --accent-tint: rgba(10, 132, 255, 0.16);
  --bar-bg: rgba(15, 15, 16, 0.72);
  --pop-bg: rgba(40, 40, 42, 0.84);
  --shadow-pop: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-panel: 0 0 0 0.5px rgba(255, 255, 255, 0.1), 0 24px 64px rgba(0, 0, 0, 0.6);
  --mark: rgba(255, 214, 10, 0.32);
  --avatar: linear-gradient(180deg, #8e939f 0%, #6b6f7a 100%);
  --t-bg: #000000;
  --t-text: #ffffff;
  --t-in: #262628;
  --t-in-press: #3a3a3c;
  --t-blue: #0a84ff;
  --t-green: #30d158;
  --t-stamp: #8d8d93;
  --t-sep: rgba(255, 255, 255, 0.12);
  --t-glass: rgba(118, 118, 128, 0.3);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: default; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
.dim { color: var(--text-3); }
mark { background: var(--mark); color: inherit; border-radius: 3px; }
time, .stats, .summary, .c-count, .c-range, .m-time, .when { font-variant-numeric: tabular-nums; }

/* ---------- toolbar ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid transparent;
  transition: border-color 200ms ease;
}
html.scrolled .bar { border-bottom-color: var(--sep); }
.bar-in {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; flex: none; }
.brand-mark { width: 20px; height: 20px; color: var(--accent); }
.search {
  flex: 1 1 auto;
  max-width: 400px;
  margin: 0 auto;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text-3);
  transition: box-shadow 150ms ease, background-color 150ms ease;
}
.search:focus-within { background: var(--surface); box-shadow: 0 0 0 3px var(--accent-tint), 0 0 0 0.5px var(--sep); }
.search svg { width: 15px; height: 15px; flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font-size: 13px;
}
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { opacity: 0.6; }
.controls { display: flex; align-items: center; gap: 8px; flex: none; }

.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: var(--fill);
}
.seg button {
  height: 28px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: background-color 150ms ease, box-shadow 150ms ease;
}
.seg button[aria-checked="true"] { background: var(--seg-on); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.seg button:active { background: var(--fill); }

.tool-btn {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  font-size: 13px;
  font-weight: 500;
  transition: transform 120ms var(--ease-out), background-color 150ms ease;
}
.tool-btn svg { width: 15px; height: 15px; }
.tool-btn:active { transform: scale(0.97); }
.tool-btn.on { background: var(--accent-tint); color: var(--accent); }
.tool-btn .count:empty { display: none; }
#filter-btn { min-width: 84px; justify-content: center; } /* no layout shift when the count appears */

/* ---------- page head ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 16px 24px 96px; }
.head h1 { margin: 8px 0 4px; font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.022em; }
.head-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; min-height: 28px; margin-bottom: 16px; }
.summary { margin: 0; font-size: 13px; color: var(--text-2); }
.summary .updated { color: var(--text-3); }
.summary .updated::before { content: "\00b7"; margin: 0 6px; }
.tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.tokens:empty { display: none; }
.token {
  height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}
.token svg { width: 14px; height: 14px; opacity: 0.8; }
.skel-line { display: inline-block; width: 220px; height: 10px; border-radius: 5px; background: var(--fill); vertical-align: middle; }

/* ---------- table rows ---------- */
.rows { position: relative; }
.row { position: relative; background: var(--surface); }
.gap { height: 12px; }

/* hairline between rows inside a group */
.conv::before, .msg::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: var(--hair-left, 16px);
  height: 1px;
  background: var(--sep);
  transform: scaleY(0.5);
  transform-origin: top;
}

/* hover and selection: an inset rounded highlight, like a macOS source list */
.conv::after, .msg::after {
  content: "";
  position: absolute;
  inset: 3px 8px 3px var(--hl-left, 8px);
  border-radius: 10px;
  pointer-events: none;
  transition: background-color 120ms ease;
}
.conv > *, .msg > * { position: relative; z-index: 1; }

/* group header (client or sender) */
.gh { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-radius: var(--r-card); padding-right: 12px; }
.gh.open { border-radius: var(--r-card) var(--r-card) 0 0; }
.row.last { border-radius: 0 0 var(--r-card) var(--r-card); }
.gh-main {
  display: grid;
  grid-template-columns: 16px 32px minmax(0, 1fr) 220px 192px 88px;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 8px 12px 16px;
  border: 0;
  background: none;
  text-align: left;
  border-radius: var(--r-card);
}
.gh-main:focus-visible { outline-offset: -2px; }
.i-disc { width: 12px; height: 12px; color: var(--text-3); transition: transform 200ms var(--ease-out); justify-self: center; }
.gh.open .i-disc { transform: rotate(90deg); }
.who { display: flex; flex-direction: column; min-width: 0; }
.name, .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name { font-size: 15px; font-weight: 600; }
.sub { font-size: 13px; color: var(--text-2); }
.stats { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.when { font-size: 13px; color: var(--text-2); text-align: right; white-space: nowrap; }
.srcs { display: flex; gap: 4px; min-width: 0; overflow: hidden; }
.badge {
  font-size: 12px;
  line-height: 18px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--fill-2);
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
}
.icon-btn, .icon-btn-space { width: 32px; height: 32px; flex: none; }
.icon-btn {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-2);
  transition: background-color 150ms ease, transform 120ms var(--ease-out);
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:active { transform: scale(0.94); background: var(--fill); }
.icon-btn[aria-expanded="true"] { background: var(--fill); color: var(--text); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--avatar);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  overflow: hidden;
  flex: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.person svg { width: 100%; height: 100%; color: rgba(255, 255, 255, 0.96); }

/* profile line under an open client */
.meta { padding: 0 16px 12px 88px; font-size: 13px; color: var(--text-3); }
.meta p { margin: 0; }
.meta .sep { display: inline-block; width: 3px; height: 3px; margin: 0 8px; border-radius: 50%; background: currentColor; opacity: 0.6; vertical-align: middle; }
.meta .sealed { display: inline-block; margin-top: 4px; color: var(--text-2); }
.meta .none { margin-top: 8px; color: var(--text-2); }
.meta.last { padding-bottom: 16px; }

/* conversation rows */
.conv {
  --hair-left: 88px;
  --hl-left: 76px;
  display: grid;
  grid-template-columns: 28px minmax(140px, 208px) minmax(0, 1fr) 104px 148px 192px 12px;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 20px 8px 88px;
}
.c-who { display: flex; flex-direction: column; min-width: 0; }
.c-name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-type { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-prev { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-count, .c-range { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-range { color: var(--text-3); }
.i-chev { width: 12px; height: 12px; color: var(--text-3); opacity: 0.7; }
.c-mob, .c-last { display: none; }
.call-note { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.i-call { width: 13px; height: 13px; color: var(--text-3); flex: none; }

/* flat message rows (Group by: None) */
.colhead, .msg {
  display: grid;
  grid-template-columns: 148px 148px 176px minmax(0, 1fr) 172px;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
}
.colhead { height: 36px; border-radius: var(--r-card) var(--r-card) 0 0; font-size: 12px; font-weight: 500; color: var(--text-3); }
.msg { --hair-left: 20px; min-height: 44px; padding-top: 8px; padding-bottom: 8px; font-size: 13px; }
.m-time { color: var(--text-2); white-space: nowrap; }
.m-time .tz { color: var(--text-3); font-size: 12px; }
.m-client { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-sender { display: flex; flex-direction: column; min-width: 0; }
.m-num { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-sender .c-type { font-size: 12px; }
.m-text { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* interaction */
@media (hover: hover) and (pointer: fine) {
  .gh:not(.open):hover { background: var(--surface-hover); }
  .conv:hover::after, .msg:hover::after { background: var(--fill-2); }
  .icon-btn:hover { background: var(--fill); color: var(--text); }
  .tool-btn:hover { background: color-mix(in srgb, var(--fill) 100%, var(--fill-2)); }
}
.conv:active::after, .msg:active::after { background: var(--fill); }
.row.sel::after, .row.sel:hover::after { background: var(--accent-tint); }
.conv:focus-visible, .msg:focus-visible { outline-offset: -2px; }

/* medium widths: drop the least important columns */
@media (max-width: 1099px) {
  .gh-main { grid-template-columns: 16px 32px minmax(0, 1fr) 168px 152px 76px; }
  .conv { grid-template-columns: 28px minmax(120px, 180px) minmax(0, 1fr) 112px 152px 12px; }
  .conv .c-range { display: none; }
  .colhead, .msg { grid-template-columns: 140px 132px 160px minmax(0, 1fr) 152px; }
}
@media (max-width: 899px) {
  .gh-main { grid-template-columns: 16px 32px minmax(0, 1fr) auto 76px; }
  .gh-main .srcs { display: none; }
  .conv { grid-template-columns: 28px minmax(120px, 170px) minmax(0, 1fr) 104px 12px; }
  .conv .srcs { display: none; }
  .colhead, .msg { grid-template-columns: 136px 116px 148px minmax(0, 1fr); }
  .colhead span:last-child, .msg .m-src { display: none; }
}

/* ---------- empty / loading / error ---------- */
.status { padding: 88px 16px; text-align: center; color: var(--text-2); }
.status h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.status p { margin: 4px auto 16px; max-width: 360px; font-size: 13px; }
.status-icon { width: 32px; height: 32px; color: var(--text-3); margin-bottom: 12px; }
.btn {
  height: 32px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  transition: transform 120ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.status.loading { padding: 0; }
.skel {
  height: 64px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 0 44px;
  border-radius: var(--r-card);
  background: var(--surface);
  animation: pulse 1.1s ease-in-out calc(var(--i) * 90ms) infinite alternate;
}
.skel-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--fill); }
.skel-text { display: flex; flex-direction: column; gap: 8px; }
.skel-text span { display: block; height: 10px; width: 160px; border-radius: 5px; background: var(--fill); }
.skel-text span + span { width: 104px; background: var(--fill-2); }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.55; } }

/* ---------- popovers, menu, toast ---------- */
.pop {
  position: fixed;
  z-index: 40;
  padding: 6px;
  border-radius: 14px;
  background: var(--pop-bg);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  opacity: 0;
  transform: scale(0.97) translateY(-4px);
  transform-origin: var(--origin, top right);
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.pop.in { opacity: 1; transform: none; }
.filter-pop { width: 248px; }
.f-sec { padding: 6px 6px 8px; }
.f-sec + .f-sec { border-top: 0.5px solid var(--sep); padding-top: 10px; }
.f-label { margin: 0 4px 6px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.seg-wide { display: flex; }
.seg-wide button { flex: 1; padding: 0; }
.checks { display: flex; flex-direction: column; }
.checks button, .menu button {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 4px;
  border: 0;
  border-radius: 7px;
  background: none;
  text-align: left;
  font-size: 13px;
}
.check { width: 20px; height: 14px; flex: none; position: relative; }
[aria-checked="true"] > .check::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  width: 5px;
  height: 10px;
  border: solid var(--accent);
  border-width: 0 1.8px 1.8px 0;
  transform: rotate(45deg);
}
.checks button:hover, .menu button:hover { background: var(--fill); }
.custom-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 4px 0; }
.custom-range label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-3); }
.custom-range input { height: 28px; padding: 0 6px; border: 0; border-radius: 7px; background: var(--fill); font-size: 12px; min-width: 0; }
.f-foot { border-top: 0.5px solid var(--sep); padding: 6px 4px 0; display: flex; justify-content: flex-end; }
.link-btn { border: 0; background: none; color: var(--accent); font-size: 13px; padding: 4px 6px; border-radius: 6px; }
.menu { width: 220px; }
.menu button { width: 100%; padding-left: 10px; }
.pop-head { padding: 6px 10px 8px; margin-bottom: 4px; border-bottom: 0.5px solid var(--sep); }
.pop-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-sub { font-size: 12px; color: var(--text-3); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 50;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--pop-bg);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.toast.in { opacity: 1; transform: translate(-50%, 0); }

/* ---------- conversation panel (Messages) ---------- */
.thread {
  position: fixed;
  top: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 30;
  width: 420px;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  background: var(--t-bg);
  color: var(--t-text);
  box-shadow: var(--shadow-panel);
  transform: translateX(calc(100% + 16px));
  visibility: hidden;
  transition: transform 260ms var(--ease-drawer), visibility 0s linear 260ms;
}
.thread.open {
  transform: none;
  visibility: visible;
  transition: transform 380ms var(--ease-drawer), visibility 0s;
}
/* Wide screens: slide the page left so the panel doesn't cover the table, when there is room. */
.bar-in, .page { transition: transform 260ms var(--ease-drawer); }
@media (min-width: 1100px) {
  html.thread-open .bar-in, html.thread-open .page {
    transform: translateX(calc(-1 * clamp(0px, 1036px - 50vw, max(0px, 50vw - 624px))));
    transition-duration: 380ms;
  }
}

@supports (corner-shape: squircle) {
  .thread { corner-shape: squircle; border-radius: 36px; }
  .row, .gh-main, .skel { corner-shape: squircle; }
  :root { --r-card: 22px; }
}

.t-bar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: start;
  padding: 10px 12px 8px;
  background: color-mix(in srgb, var(--t-bg) 80%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--t-sep);
}
.t-glass {
  width: 32px;
  height: 32px;
  margin-top: 6px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--t-glass);
  color: var(--t-text);
  transition: transform 120ms var(--ease-out), background-color 150ms ease;
}
.t-glass:active { transform: scale(0.94); }
.t-glass svg { width: 14px; height: 14px; }
.t-glass span { display: grid; }
.g-back { display: none !important; }
.t-who { grid-column: 2; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.t-avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--avatar); color: #fff; }
.t-avatar svg { width: 100%; height: 100%; display: block; }
.t-name { max-width: 100%; font-size: 12px; line-height: 14px; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.t-scroll {
  position: relative;
  z-index: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding: 92px 0 16px;
  outline: none;
}
.t-thread {
  display: flex;
  flex-direction: column;
  padding: 0 16px;
  font-size: 15px;
  line-height: 20px;
  letter-spacing: -0.2px;
}
.t-stamp { margin: 16px 0 8px; text-align: center; font-size: 12px; line-height: 16px; letter-spacing: 0; color: var(--t-stamp); }
.t-stamp b { font-weight: 600; }
.t-stamp.first { margin-top: 4px; }
.t-row { display: flex; margin-top: 2px; }
.t-row.g-start { margin-top: 8px; }
.t-stamp + .t-row { margin-top: 0; }
.t-row.out { justify-content: flex-end; }
.b {
  position: relative;
  max-width: 75%;
  padding: 6px 12px;
  border-radius: 17px;
  background: var(--t-in);
  color: var(--t-text);
  white-space: pre-wrap;
  overflow-wrap: break-word;
  outline: none;
  transition: background-color 150ms ease;
}
.b-text { position: relative; z-index: 2; }
.b a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; cursor: pointer; }
.b.out.blue { background: var(--t-blue); color: #fff; }
.b.out.green { background: var(--t-green); color: #fff; }
.b.sel { background: var(--t-in-press); }
.b.out.blue.sel { background: color-mix(in srgb, var(--t-blue) 82%, #000); }
.b.out.green.sel { background: color-mix(in srgb, var(--t-green) 82%, #000); }
.b:focus-visible { box-shadow: 0 0 0 2px var(--t-bg), 0 0 0 4px var(--accent); }
.b-empty { opacity: 0.6; font-style: italic; }
/* Bubble tails */
.b.tail::before, .b.tail::after { content: ""; position: absolute; bottom: 0; height: 20px; }
.b.in.tail::before { z-index: 0; left: -7px; width: 20px; background: inherit; border-bottom-right-radius: 15px; }
.b.in.tail::after { z-index: 1; left: -10px; width: 10px; background: var(--t-bg); border-bottom-right-radius: 10px; }
.b.out.tail::before { z-index: 0; right: -7px; width: 20px; background: inherit; border-bottom-left-radius: 15px; }
.b.out.tail::after { z-index: 1; right: -10px; width: 10px; background: var(--t-bg); border-bottom-left-radius: 10px; }

.t-call {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0;
  color: var(--t-stamp);
  transition: background-color 300ms ease;
}
.t-call svg { width: 12px; height: 12px; }
.t-call.flash { background: var(--fill); }

.t-foot { flex: none; border-top: 0.5px solid var(--t-sep); background: var(--t-bg); font-size: 12px; line-height: 16px; letter-spacing: 0; }
.t-foot-bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 12px;
  text-align: left;
}
.t-foot-bar > svg { width: 14px; height: 14px; flex: none; }
.t-foot-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.t-foot-on { color: var(--text-2); font-variant-numeric: tabular-nums; }
.t-foot-on, .t-foot-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-foot-more { color: var(--text-2); }
.t-foot-chev svg { width: 12px; height: 12px; display: block; transform: rotate(180deg); transition: transform 200ms var(--ease-out); }
.details-open .t-foot-chev svg { transform: none; }
.t-foot-body { max-height: 44vh; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 16px; color: var(--text-2); }
.t-foot-body dl { margin: 0; }
.d-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; padding: 4px 0; }
.d-row dt { color: var(--text-3); }
.d-row dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.d-dim { color: var(--text-3); }
.d-hash { font-size: 11px; word-break: break-all; }
.d-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0 4px; font-weight: 600; color: var(--text); }
.d-link { border: 0; background: none; padding: 0 0 0 8px; color: var(--accent); font-size: 12px; }
.d-caps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.d-caps li { display: flex; flex-direction: column; }
.d-hint { margin: 8px 0 0; color: var(--text-3); }

/* ---------- phone width ---------- */
@media (max-width: 719px) {
  .bar-in { flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .brand { display: none; }
  .search { order: 1; flex: 1 1 0; max-width: none; margin: 0; }
  .controls { order: 2; display: contents; }
  #filter-btn { order: 2; }
  .controls .seg { order: 3; width: 100%; }
  .controls .seg button { flex: 1; padding: 0; }
  .page { padding: 8px 16px 80px; }
  .head h1 { margin-top: 4px; }

  .gh { padding-right: 4px; }
  .gh-main {
    grid-template-columns: 12px 32px minmax(0, 1fr) auto;
    grid-template-areas: "disc av who when" "disc av stats stats" "disc av srcs srcs";
    column-gap: 10px;
    row-gap: 2px;
    align-items: start;
    padding: 12px 4px 12px 12px;
  }
  .gh-main .i-disc { grid-area: disc; align-self: center; }
  .gh-main .avatar { grid-area: av; align-self: center; }
  .gh-main .who { grid-area: who; }
  .gh-main .stats { grid-area: stats; }
  .gh-main .srcs { grid-area: srcs; display: flex; margin-top: 4px; }
  .gh-main .when { grid-area: when; padding-top: 2px; }
  .meta { padding: 0 16px 12px 66px; }

  .conv {
    --hair-left: 70px;
    --hl-left: 20px;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    grid-template-areas: "av who range" "av prev prev" "av count srcs";
    column-gap: 10px;
    row-gap: 2px;
    align-items: start;
    padding: 12px 16px 12px 32px;
  }
  .conv .avatar { grid-area: av; }
  .conv .c-who { grid-area: who; }
  .conv[data-act] .c-who .c-type { display: none; }
  .conv .c-prev { grid-area: prev; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .conv .c-count, .conv .c-range { display: none; }
  .conv .c-mob { grid-area: count; display: block; align-self: center; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .conv .c-last { grid-area: range; display: block; font-size: 13px; color: var(--text-3); padding-top: 2px; white-space: nowrap; }
  .conv .srcs { grid-area: srcs; display: flex; justify-content: flex-end; }
  .conv .i-chev { display: none; }

  .colhead { display: none; }
  .msg {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "sender time" "text text" "client src";
    gap: 2px 12px;
    padding: 12px 16px;
  }
  .msg.first { border-radius: var(--r-card) var(--r-card) 0 0; }
  .msg.first.last { border-radius: var(--r-card); }
  .msg.first::before { display: none; }
  .m-time { grid-area: time; }
  .m-sender { grid-area: sender; flex-direction: row; gap: 6px; align-items: baseline; }
  .m-num { font-weight: 500; font-size: 15px; }
  .m-text { grid-area: text; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .m-client { grid-area: client; color: var(--text-3); align-self: center; }
  .msg .m-src { grid-area: src; display: block; justify-self: end; }
  .m-sender .c-type { display: none; }

  .thread { inset: 0; width: 100vw; border-radius: 0; transform: translateX(100%); corner-shape: round; }
  .t-thread { font-size: 17px; line-height: 22px; letter-spacing: -0.4px; }
  .b { padding: 7px 12px; border-radius: 18px; }
  .t-bar { padding-top: max(10px, env(safe-area-inset-top)); }
  .t-scroll { padding-top: calc(92px + env(safe-area-inset-top)); }
  .g-x { display: none !important; }
  .t-foot-more { display: none; }
  .g-back { display: grid !important; }
  html.thread-open body { overflow: hidden; }
}

/* ---------- motion & material preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .thread, .thread.open { transform: none; opacity: 0; transition: opacity 180ms ease, visibility 0s linear 180ms; }
  .thread.open { opacity: 1; transition: opacity 180ms ease, visibility 0s; }
  .pop, .toast { transform: none !important; }
  .t-scroll { scroll-behavior: auto; }
  .bar-in, .page { transition: none; }
  .i-disc, .t-foot-chev svg { transition: none; }
  .skel { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .bar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .pop, .toast { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .t-bar { background: var(--t-bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
