/* Sauna prototype — single stylesheet.
   Discord-shaped chrome, Claude-shaped agency.
   Mobile-first. Tokens at the top, components in the middle,
   responsive overrides at the very bottom (source-order wins).
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
 * DESIGN TOKENS — dark by default (Discord's default)
 * data-theme="light" on <html> flips palette
 * ============================================================ */

:root, html[data-theme="dark"] {
  /* surfaces — Discord-style three-tier dark */
  --bg-server:    #1A1B1E;          /* leftmost rail (server list, mindset bar) */
  --bg-rail:      #2B2D31;          /* channel list */
  --bg-conv:      #313338;          /* conversation pane */
  --bg-panel:     #313338;          /* artifact panel */
  --bg-card:      #2B2D31;
  --bg-elevated:  #383A40;          /* composer, popovers */
  --bg-popover:   #232428;
  --bg-row-hover: rgba(255,255,255,0.04);
  --bg-row-sel:   #404249;
  --bg-row-on:    #5865F230;        /* mention/active sidebar row */
  --bg-overlay:   rgba(0,0,0,0.65);
  --bg-msg-hover: rgba(4,4,5,0.07);
  --bg-tooltip:   #111214;

  /* ink */
  --ink-1: #F2F3F5;                 /* primary text */
  --ink-2: #B5BAC1;                 /* default body */
  --ink-3: #949BA4;                 /* muted */
  --ink-4: #6D6F78;                 /* very muted */
  --ink-bright: #FFFFFF;
  --ink-link: #00A8FC;

  /* hairlines */
  --hair:        rgba(255,255,255,0.06);
  --hair-soft:   rgba(255,255,255,0.04);
  --hair-strong: rgba(255,255,255,0.10);

  /* accents */
  --blurple:        #5865F2;        /* Discord blurple */
  --blurple-strong: #4752C4;
  --blurple-bg:     #5865F222;
  --green:          #23A559;        /* Discord green / online */
  --green-strong:   #1E8E4D;
  --green-subtle:   #23A55922;
  --yellow:         #F0B232;        /* idle */
  --yellow-bg:      #F0B23222;
  --red:            #F23F42;        /* error / mention */
  --red-bg:         #F23F4222;
  --pink:           #EB459E;
  --teal:           #0FBEAC;

  /* user color tokens (deterministic per-user) */
  --u-westin: #C490FF;
  --u-sarah:  #5BC9FF;
  --u-marcus: #FF8B6E;
  --u-anna:   #F2C94C;
  --u-sauna:  #57F287;              /* the agent reads as fresh green */

  /* sizing */
  --radius-1: 4px;
  --radius-2: 8px;
  --radius-3: 12px;
  --radius-4: 16px;

  /* layout */
  --server-w: 60px;                 /* leftmost mindset rail */
  --rail-w:   272px;                /* channel list */
  --panel-w:  640px;
  --members-w: 200px;
  --topbar-h: 28px;

  /* type */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  /* shadows */
  --shadow-1: 0 1px 0 rgba(0,0,0,0.20), 0 1.5px 3px rgba(0,0,0,0.20);
  --shadow-2: 0 4px 12px -2px rgba(0,0,0,0.32), 0 0 0 1px rgba(0,0,0,0.40);
  --shadow-3: 0 8px 32px -4px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,0,0,0.30);

  /* motion */
  --ease:     cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-1: 100ms;
  --dur-2: 180ms;
  --dur-3: 320ms;

  color-scheme: dark;
}

html[data-theme="light"] {
  --bg-server:    #E3E5E8;
  --bg-rail:      #F2F3F5;
  --bg-conv:      #FFFFFF;
  --bg-panel:     #FFFFFF;
  --bg-card:      #F2F3F5;
  --bg-elevated:  #EBEDEF;
  --bg-popover:   #FFFFFF;
  --bg-row-hover: rgba(6,6,7,0.04);
  --bg-row-sel:   #DBDDE1;
  --bg-row-on:    #5865F215;
  --bg-overlay:   rgba(120,120,128,0.32);
  --bg-msg-hover: rgba(6,6,7,0.025);
  --bg-tooltip:   #181818;

  --ink-1: #060607;
  --ink-2: #2E3338;
  --ink-3: #4E5058;
  --ink-4: #6D6F78;
  --ink-bright: #060607;
  --ink-link: #006CE7;

  --hair:        rgba(6,6,7,0.07);
  --hair-soft:   rgba(6,6,7,0.04);
  --hair-strong: rgba(6,6,7,0.12);

  --green-subtle: #23A55918;
  --blurple-bg:   #5865F215;
  --yellow-bg:    #F0B23218;
  --red-bg:       #F23F4218;

  --u-westin: #7B3FE4;
  --u-sarah:  #1E88E5;
  --u-marcus: #E2552B;
  --u-anna:   #B6831A;
  --u-sauna:  #1E8E4D;

  --shadow-1: 0 1px 1px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-2: 0 4px 16px -2px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-3: 0 12px 36px -6px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);

  color-scheme: light;
}

/* ============================================================
 * RESET + BASE
 * ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink-1);
  background: var(--bg-server);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, textarea { font: inherit; color: inherit; background: none; border: 0; outline: 0; }
ul, ol { list-style: none; padding: 0; margin: 0; }
a { color: var(--ink-link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
::selection { background: var(--blurple); color: white; }
[hidden] { display: none !important; }

/* ============================================================
 * APP SHELL — four columns desktop:
 *   server (mindset rail) · rail (channels) · conv · panel
 * ============================================================ */

.app {
  display: grid;
  height: 100dvh;
  width: 100dvw;
  grid-template-rows: 1fr;
  grid-template-columns: var(--server-w) var(--rail-w) 1fr var(--panel-w);
  grid-template-areas: "server rail conv panel";
  background: var(--bg-server);
}

/* ============================================================
 * TITLEBAR (fixed, desktop chrome)
 * ============================================================ */
.titlebar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: none;
  align-items: center;
  padding: 0 14px;
  background: var(--bg-server);
  border-bottom: 1px solid var(--hair-soft);
  z-index: 50;
  -webkit-app-region: drag;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  user-select: none;
}
.tl-dots { display: flex; gap: 6px; }
.tl-dots i { width: 11px; height: 11px; border-radius: 50%; background: rgba(255,255,255,0.10); }
.tl-title { flex: 1; text-align: center; opacity: 0.9; }

/* ============================================================
 * SERVER RAIL — leftmost column, like Discord's server list.
 * Each entry is a mindset.
 * ============================================================ */
.server {
  grid-area: server;
  background: var(--bg-server);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
  border-right: 1px solid transparent;
}
.server__brand {
  width: 42px; height: 42px;
  border-radius: 14px;
  background: var(--green);
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 16px;
  box-shadow: var(--shadow-1);
  transition: border-radius var(--dur-2) var(--ease-out), background var(--dur-2) var(--ease);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}
.server__brand::before {
  content: ''; position: absolute; top: 50%; left: -16px;
  transform: translateY(-50%);
  width: 8px; height: 40px; border-radius: 0 4px 4px 0;
  background: white;
  transition: height var(--dur-2) var(--ease-out);
}
.server__brand:hover { border-radius: 16px; }
.server__divider { width: 32px; height: 2px; background: var(--hair-strong); border-radius: 1px; flex-shrink: 0; }

.server__pill {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 16px;
  background: var(--bg-rail);
  display: grid; place-items: center;
  font-size: 16px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-radius var(--dur-2) var(--ease-out), background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
  flex-shrink: 0;
}
.server__pill::before {
  content: ''; position: absolute; top: 50%; left: -16px;
  transform: translateY(-50%);
  width: 8px; height: 8px; border-radius: 4px;
  background: var(--ink-1);
  opacity: 0;
  transition: height var(--dur-2) var(--ease-out), opacity var(--dur-2) var(--ease);
}
.server__pill:hover {
  border-radius: 14px;
  background: var(--blurple);
  color: white;
}
.server__pill:hover::before { opacity: 1; height: 20px; }
.server__pill.is-active { border-radius: 14px; background: var(--blurple); color: white; }
.server__pill.is-active::before { opacity: 1; height: 40px; }

.server__pill .badge-dot {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: grid; place-items: center;
  border: 3px solid var(--bg-server);
}

/* tooltip on hover (CSS-only) */
.server__pill[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 14px);
  top: 50%; transform: translateY(-50%);
  background: var(--bg-tooltip);
  color: white;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-1);
  z-index: 100;
  pointer-events: none;
}

/* ============================================================
 * RAIL — channel list (per-mindset)
 * ============================================================ */
.rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  background: var(--bg-rail);
  min-width: 0;
  position: relative;
}

.rail__top {
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
  height: 48px;
  border-bottom: 1px solid var(--hair);
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
  position: relative;
  z-index: 2;
}
.rail__title {
  flex: 1;
  font-size: 15px; font-weight: 600;
  color: var(--ink-1);
  letter-spacing: -0.01em;
}
.icon-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  color: var(--ink-3);
  border-radius: var(--radius-1);
  transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--ink-1); background: var(--bg-row-hover); }
.icon-btn svg { width: 18px; height: 18px; }

.rail__filter {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 8px 10px 0;
  background: rgba(0,0,0,0.20);
  border-radius: var(--radius-1);
  padding: 2px;
}
html[data-theme="light"] .rail__filter { background: rgba(0,0,0,0.06); }
.rail__filter button {
  padding: 5px 0;
  font-size: 11px; font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 3px;
  transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.rail__filter button:hover { color: var(--ink-1); }
.rail__filter button.is-active {
  background: var(--bg-elevated);
  color: var(--ink-1);
  box-shadow: var(--shadow-1);
}
.rail__filter .count {
  font-family: var(--font-mono);
  font-size: 9px; opacity: 0.6;
  margin-left: 3px;
  font-weight: 500;
}

.rail__list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.30) transparent;
}
.rail__list::-webkit-scrollbar { width: 8px; }
.rail__list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.30); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
.rail__list::-webkit-scrollbar-thumb:hover { background-color: rgba(0,0,0,0.45); background-clip: content-box; }

/* category header — Discord style: all-caps, tight tracking, chevron */
.section {
  display: flex; align-items: center;
  padding: 18px 8px 4px 6px;
  cursor: pointer;
  user-select: none;
  color: var(--ink-3);
  transition: color var(--dur-1) var(--ease);
}
.section:hover { color: var(--ink-1); }
.section .chev {
  width: 12px; height: 12px;
  display: grid; place-items: center;
  transition: transform var(--dur-2) var(--ease-out);
  margin-right: 2px;
}
.section .chev svg { width: 12px; height: 12px; }
.section.is-collapsed .chev { transform: rotate(-90deg); }
.section h4 {
  margin: 0; flex: 1;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.section .add {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 3px;
  color: var(--ink-3);
  opacity: 0;
}
.section:hover .add { opacity: 1; }
.section .add:hover { color: var(--ink-1); background: var(--bg-row-hover); }
.section .add svg { width: 14px; height: 14px; }
.section.is-collapsed + .channel-group { display: none; }

.channel-group { display: flex; flex-direction: column; gap: 1px; }

/* channel-style row */
.channel {
  display: flex; align-items: center;
  gap: 6px;
  padding: 5px 8px;
  margin-left: 0;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  color: var(--ink-3);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
  user-select: none;
  min-height: 32px;
}
.channel:hover { background: var(--bg-row-hover); color: var(--ink-2); }
.channel.is-active { background: var(--bg-row-sel); color: var(--ink-1); }
.channel.has-unread { color: var(--ink-1); font-weight: 500; }

/* unread bar on left edge — Discord pattern */
.channel.has-unread::before {
  content: '';
  position: absolute;
  left: -8px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 8px;
  background: var(--ink-1);
  border-radius: 0 4px 4px 0;
}

.channel__hash {
  flex-shrink: 0;
  color: var(--ink-3);
  font-size: 16px;
  width: 20px;
  text-align: center;
  line-height: 1;
}
.channel.is-active .channel__hash, .channel.has-unread .channel__hash { color: var(--ink-1); }
.channel__hash svg { width: 18px; height: 18px; vertical-align: middle; }

/* status pip overrides hash for special states */
.channel__hash.pip {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin: 0 6px;
  background: var(--ink-4);
}
.channel__hash.pip[data-status="working"]   { background: var(--green); box-shadow: 0 0 0 0 var(--green); animation: pulseGlow 2s var(--ease-out) infinite; }
.channel__hash.pip[data-status="waiting"]   { background: var(--yellow); }
.channel__hash.pip[data-status="needs_decision"] { background: var(--red); }
.channel__hash.pip[data-status="done"]      { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-4); }
.channel__hash.pip[data-status="idle"]      { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-4); }

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--green); }
  50%      { box-shadow: 0 0 0 4px transparent; }
}

.channel__name {
  flex: 1; min-width: 0;
  font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.005em;
}

.channel__meta { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.channel__age { font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); }
.channel__mention {
  background: var(--red);
  color: white;
  border-radius: 999px;
  padding: 1px 6px; font-size: 10.5px; font-weight: 700;
  min-width: 16px; text-align: center;
  font-variant-numeric: tabular-nums;
}

/* hover-only quick action */
.channel__qa {
  position: absolute;
  right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--bg-elevated);
  border-radius: 4px;
  font-size: 11px; font-weight: 600;
  padding: 4px 9px;
  color: var(--ink-1);
  opacity: 0; pointer-events: none;
  box-shadow: var(--shadow-1);
  letter-spacing: 0.01em;
}
.channel:hover .channel__qa { opacity: 1; pointer-events: auto; }
.channel:hover .channel__qa:hover { background: var(--green); color: white; }
.channel:hover .channel__age, .channel:hover .channel__mention { opacity: 0; }

/* avatar stack for shared channels (replaces hash) */
.avatars {
  display: flex; align-items: center;
  flex-shrink: 0;
}
.avatar {
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-weight: 600;
  flex-shrink: 0;
  background: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.channel .avatars .avatar { width: 16px; height: 16px; font-size: 9px; border: 1.5px solid var(--bg-rail); margin-left: -4px; }
.channel .avatars .avatar:first-child { margin-left: 0; }

/* user footer — Discord pattern, themed by current theme */
.rail__user {
  display: flex; align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(0,0,0,0.20);
  position: relative;
  z-index: 2;
  border-top: 1px solid transparent;
}
html[data-theme="light"] .rail__user { background: rgba(0,0,0,0.04); }
.rail__user .avatar { width: 32px; height: 32px; font-size: 13px; }
.rail__user__id {
  flex: 1; min-width: 0;
}
.rail__user .name { font-size: 13px; font-weight: 600; line-height: 1.2; color: var(--ink-1); }
.rail__user .tag { font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); }
.rail__user .footer-actions { display: flex; gap: 2px; }
.rail__user .icon-btn { width: 32px; height: 32px; }
.rail__user .icon-btn svg { width: 18px; height: 18px; }

/* ============================================================
 * CONVERSATION
 * ============================================================ */
.conv {
  grid-area: conv;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-conv);
  position: relative;
}

.conv__header {
  display: flex; align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 48px;
  border-bottom: 1px solid var(--hair);
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
  position: relative;
  z-index: 2;
}
.conv__back {
  display: none;
  width: 32px; height: 32px;
  align-items: center; justify-content: center;
  color: var(--ink-2);
  border-radius: 4px;
  margin-left: -4px;
  flex-shrink: 0;
}
.conv__back:hover { background: var(--bg-row-hover); color: var(--ink-1); }
.conv__back svg { width: 22px; height: 22px; }
.conv__hash { color: var(--ink-3); font-size: 22px; line-height: 1; flex-shrink: 0; }
.conv__hash svg { width: 22px; height: 22px; }
.conv__title {
  font-size: 16px; font-weight: 600;
  color: var(--ink-1);
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
  flex: 1;
}
.conv__title .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv__crumb { color: var(--ink-3); font-weight: 400; font-size: 13px; }
.conv__divider { width: 1px; height: 24px; background: var(--hair-strong); margin: 0 4px; }
.conv__working {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--green);
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--green-subtle);
  font-weight: 500;
}
.conv__working .pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulseGlow 1.6s var(--ease-out) infinite;
}
.conv__actions {
  display: flex; align-items: center; gap: 4px;
  margin-left: auto;
}
.conv__open-panel {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 12px; font-weight: 500;
  color: var(--ink-1);
  border-radius: 4px;
  background: var(--bg-row-hover);
}
.conv__open-panel:hover { background: var(--bg-row-sel); }

.transcript {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.30) transparent;
}
.transcript::-webkit-scrollbar { width: 14px; }
.transcript::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.20); border-radius: 7px; border: 4px solid transparent; background-clip: content-box; }
.transcript::-webkit-scrollbar-thumb:hover { background-color: rgba(0,0,0,0.35); background-clip: content-box; }

/* a "turn" is one author's message; continuation messages collapse */
.turn {
  position: relative;
  padding: 2px 16px 2px 64px;
  margin: 0 -16px;
  transition: background var(--dur-1) var(--ease);
}
.turn:hover { background: var(--bg-msg-hover); }
.turn--head { padding-top: 16px; }

.turn .av {
  position: absolute;
  left: 16px; top: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: opacity var(--dur-1) var(--ease);
  background: var(--ink-3);
}
.turn .av img { width: 100%; height: 100%; border-radius: 50%; }
.turn--cont .av { display: none; }

.turn .av.is-agent {
  background: var(--u-sauna);
  color: var(--bg-conv);
}
html[data-theme="light"] .turn .av.is-agent { color: white; }

.turn .meta {
  display: flex; align-items: baseline;
  gap: 8px;
  margin-bottom: 0;
  line-height: 1.375;
}
.turn .meta .name {
  font-size: 15px; font-weight: 600;
  color: var(--ink-1);
  letter-spacing: -0.005em;
}
.turn .meta .tag-bot {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--green);
  color: white;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
  position: relative;
  top: -2px;
}
.turn .meta .tag-bot::before {
  content: '';
  width: 8px; height: 8px;
  background: white;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m4 7 3 3 5-5' stroke='%23000' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m4 7 3 3 5-5' stroke='%23000' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}
.turn .meta .time { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.turn .text {
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-2);
  word-wrap: break-word;
}
.turn .text strong { font-weight: 600; color: var(--ink-1); }
.turn .text code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: rgba(0,0,0,0.30);
  padding: 1px 5px; border-radius: 4px;
  color: var(--ink-1);
}
html[data-theme="light"] .turn .text code { background: rgba(6,6,7,0.06); }

/* timestamp on continuation message hover */
.turn--cont .micro-time {
  position: absolute;
  left: 24px; top: 4px;
  font-size: 10px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  font-family: var(--font-mono);
}
.turn--cont:hover .micro-time { opacity: 1; }

/* hover toolbar */
.turn__hover {
  position: absolute;
  top: -14px; right: 16px;
  display: flex;
  background: var(--bg-popover);
  border-radius: 6px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-1) var(--ease);
  z-index: 5;
}
.turn:hover .turn__hover { opacity: 1; pointer-events: auto; }
.turn__hover button {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  color: var(--ink-3);
  transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.turn__hover button:first-child { border-radius: 6px 0 0 6px; }
.turn__hover button:last-child  { border-radius: 0 6px 6px 0; }
.turn__hover button:hover { color: var(--ink-1); background: var(--bg-row-hover); }
.turn__hover button svg { width: 16px; height: 16px; }

/* tool-use lines (Claude-style chevroned thoughts) */
.tool-line {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
  color: var(--ink-3);
  padding: 2px 0;
  font-family: var(--font-mono);
}
.tool-line svg { width: 12px; height: 12px; color: var(--ink-4); flex-shrink: 0; }
.tool-line .label { color: var(--ink-2); font-family: var(--font-sans); font-size: 13px; }
.tool-line .detail { color: var(--ink-4); }
.tool-line .detail::before { content: ' · '; }

/* inline action card */
.action-row { display: flex; gap: 8px; padding: 8px 0 4px; flex-wrap: wrap; }
.btn {
  font-size: 13px; font-weight: 500;
  padding: 7px 14px;
  border-radius: 4px;
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn--primary { background: var(--blurple); color: white; }
.btn--primary:hover { background: var(--blurple-strong); }
.btn--green { background: var(--green); color: white; }
.btn--green:hover { background: var(--green-strong); }
.btn--ghost { background: transparent; color: var(--ink-1); border: 1px solid var(--hair-strong); }
.btn--ghost:hover { background: var(--bg-row-hover); border-color: var(--ink-3); }
.btn--danger { background: var(--red); color: white; }
.btn--danger:hover { filter: brightness(1.1); }

.artifact-link {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--hair);
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 4px;
  color: var(--ink-1);
  font-size: 13px; font-weight: 500;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
  cursor: pointer;
}
.artifact-link:hover { background: var(--bg-row-sel); border-color: var(--hair-strong); text-decoration: none; }
.artifact-link::before { content: '📄 '; }

/* ============================================================
 * COMPOSER — Discord pattern: rounded grey, + on left, icons on right
 * ============================================================ */
.composer-wrap {
  padding: 0 16px 24px;
  background: var(--bg-conv);
  position: relative;
}
.composer {
  display: flex; align-items: stretch;
  gap: 0;
  padding: 0;
  background: var(--bg-elevated);
  border-radius: 8px;
  position: relative;
  transition: box-shadow var(--dur-1) var(--ease);
}
.composer:focus-within { box-shadow: 0 0 0 1.5px var(--blurple); }

.composer__plus {
  width: 44px;
  display: grid; place-items: center;
  color: var(--ink-3);
  border-radius: 8px 0 0 8px;
  flex-shrink: 0;
  cursor: pointer;
  transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.composer__plus:hover { color: var(--ink-1); }
.composer__plus svg { width: 22px; height: 22px; }

.composer__field {
  flex: 1;
  display: flex; align-items: center;
  padding: 11px 0;
  min-height: 44px;
}
.composer__field input {
  flex: 1;
  font-size: 15px;
  padding: 0;
  width: 100%;
  color: var(--ink-1);
}
.composer__field input::placeholder { color: var(--ink-3); }

.composer__icons {
  display: flex; align-items: center;
  padding-right: 8px;
  gap: 0;
  flex-shrink: 0;
}
.composer__icons button {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  color: var(--ink-3);
  border-radius: 4px;
  transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.composer__icons button:hover { color: var(--ink-1); }
.composer__icons button svg { width: 22px; height: 22px; }
.composer__icons .send-btn:not(.is-armed) { display: none; }
.composer__icons .send-btn.is-armed { color: var(--blurple); }
.composer__icons .send-btn.is-armed:hover { color: var(--blurple-strong); }

/* mic — voice mode toggles waveform overlay */
.composer__mic { color: var(--ink-3); position: relative; }
.composer__mic.is-recording { color: var(--red); }
.composer__mic.is-recording::before {
  content: '';
  position: absolute; inset: 4px;
  border-radius: 50%;
  border: 1.5px solid var(--red);
  opacity: 0;
  animation: micPulse 1.4s var(--ease-out) infinite;
}
@keyframes micPulse {
  0%   { transform: scale(0.85); opacity: 0.6; }
  100% { transform: scale(1.7);  opacity: 0; }
}

/* waveform takes over field while recording */
.waveform {
  display: none;
  flex: 1;
  align-items: center; justify-content: center;
  gap: 2px; height: 44px;
}
.waveform.is-visible { display: flex; }
.waveform i {
  width: 2px; background: var(--red);
  border-radius: 1px;
  animation: wave 0.9s var(--ease) infinite;
  height: 30%;
}
.waveform i:nth-child(1)  { animation-delay: 0s; }
.waveform i:nth-child(2)  { animation-delay: 0.05s; }
.waveform i:nth-child(3)  { animation-delay: 0.1s; }
.waveform i:nth-child(4)  { animation-delay: 0.15s; }
.waveform i:nth-child(5)  { animation-delay: 0.2s; }
.waveform i:nth-child(6)  { animation-delay: 0.25s; }
.waveform i:nth-child(7)  { animation-delay: 0.3s; }
.waveform i:nth-child(8)  { animation-delay: 0.35s; }
.waveform i:nth-child(9)  { animation-delay: 0.4s; }
.waveform i:nth-child(10) { animation-delay: 0.45s; }
.waveform i:nth-child(11) { animation-delay: 0.5s; }
.waveform i:nth-child(12) { animation-delay: 0.55s; }
@keyframes wave {
  0%, 100% { height: 25%; }
  50%      { height: 90%; }
}

.composer-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0 0 4px;
  font-size: 12px;
  color: var(--ink-3);
  min-height: 16px;
}
.dot-bounce { display: inline-flex; gap: 3px; align-items: center; margin-right: 4px; }
.dot-bounce i {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: dotBounce 1.2s var(--ease) infinite;
}
.dot-bounce i:nth-child(2) { animation-delay: 0.15s; }
.dot-bounce i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%           { transform: translateY(-3px); opacity: 1; }
}
.composer-foot .typing { color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.composer-foot .typing strong { color: var(--ink-1); font-weight: 600; }
.composer-foot .spec { margin-left: auto; font-family: var(--font-mono); font-size: 11px; opacity: 0.8; }

/* ============================================================
 * MEMBERS — right-side member list (shared threads only)
 * Discord-style: grouped by presence, names colored
 * ============================================================ */
.members {
  display: none;
  flex-direction: column;
  background: var(--bg-rail);
  border-left: 1px solid var(--hair);
  width: var(--members-w);
  flex-shrink: 0;
  overflow-y: auto;
  padding: 12px 8px;
}
.members.is-on { display: flex; }
.members__group {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  padding: 14px 8px 4px;
}
.members__group:first-child { padding-top: 4px; }
.member {
  display: flex; align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease);
}
.member:hover { background: var(--bg-row-hover); }
.member__av { position: relative; flex-shrink: 0; }
.member__av .avatar { width: 32px; height: 32px; font-size: 13px; }
.member__presence {
  position: absolute; bottom: -2px; right: -2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--ink-4);
  border: 3px solid var(--bg-rail);
}
.member__presence[data-p="online"] { background: var(--green); }
.member__presence[data-p="idle"]   { background: var(--yellow); }
.member__presence[data-p="dnd"]    { background: var(--red); }
.member__name {
  font-size: 14px; font-weight: 500;
  color: var(--ink-1);
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member__name[data-bot] { color: var(--u-sauna); }
.member__activity {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ============================================================
 * ARTIFACT PANEL
 * ============================================================ */
.panel {
  grid-area: panel;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-left: 1px solid var(--hair);
  min-width: 0;
}
.panel__tabs {
  display: flex;
  padding: 0 12px;
  background: var(--bg-rail);
  border-bottom: 1px solid var(--hair);
  align-items: stretch;
  gap: 1px;
  overflow-x: auto;
  scrollbar-width: none;
  height: 48px;
}
.panel__tabs::-webkit-scrollbar { display: none; }

.tab {
  display: flex; align-items: center;
  gap: 6px;
  padding: 0 14px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-3);
  background: transparent;
  position: relative;
  white-space: nowrap;
  transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
  height: 100%;
}
.tab:hover { color: var(--ink-2); background: var(--bg-row-hover); }
.tab.is-active {
  color: var(--ink-1);
  background: var(--bg-panel);
  font-weight: 600;
}
.tab.is-active::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--blurple);
}
.tab__pip {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-4);
  flex-shrink: 0;
}
.tab[data-kind="session"] .tab__pip { background: var(--blurple); }
.tab[data-kind="shared"]  .tab__pip { background: var(--pink); }
.tab[data-kind="home"]    .tab__pip { display: none; }
.tab__icon { font-size: 14px; }
.tab.is-home {
  padding: 0 14px;
  border-right: 1px solid var(--hair);
}
.tab.is-home svg { width: 18px; height: 18px; }
.tab__close {
  width: 16px; height: 16px;
  display: grid; place-items: center;
  color: var(--ink-4);
  border-radius: 3px;
  opacity: 0;
  margin-left: 2px;
  transition: opacity var(--dur-1) var(--ease), color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.tab:hover .tab__close, .tab.is-active .tab__close { opacity: 1; }
.tab__close:hover { color: var(--ink-1); background: var(--bg-row-hover); }
.tab__close svg { width: 12px; height: 12px; }

.tab-add {
  display: grid; place-items: center;
  width: 36px;
  color: var(--ink-3);
}
.tab-add:hover { color: var(--ink-1); background: var(--bg-row-hover); }
.tab-add svg { width: 16px; height: 16px; }

.panel__close {
  margin-left: auto;
  padding: 0 12px;
  display: none;
  align-items: center; justify-content: center;
  color: var(--ink-3);
}
.panel__close:hover { color: var(--ink-1); }
.panel__close svg { width: 18px; height: 18px; }

.panel__sub {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 24px;
  font-size: 13px; color: var(--ink-3);
  border-bottom: 1px solid var(--hair-soft);
}
.panel__sub .title { font-weight: 600; color: var(--ink-1); font-size: 14px; }
.badge {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--green-subtle);
  color: var(--green);
  font-weight: 600;
  margin-left: auto;
}
.badge[data-tone="review"] { background: var(--yellow-bg); color: var(--yellow); }
.badge[data-tone="live"]   { background: var(--blurple-bg); color: var(--blurple); }

.panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 80px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.30) transparent;
}
.panel__body::-webkit-scrollbar { width: 14px; }
.panel__body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.20); border-radius: 7px; border: 4px solid transparent; background-clip: content-box; }

.h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.015em; color: var(--ink-1); }
.h1-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 24px; }

.atable { width: 100%; border-collapse: collapse; font-size: 14px; }
.atable thead th {
  text-align: left;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--hair);
}
.atable thead th:last-child { text-align: right; }
.atable tbody td {
  padding: 12px 0;
  border-bottom: 1px solid var(--hair-soft);
  color: var(--ink-2);
}
.atable tbody td:first-child { color: var(--ink-1); }
.atable tbody td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-1);
  font-weight: 500;
}
.atable tr.flag td { color: var(--red); }
.atable tr.flag td:first-child {
  position: relative; padding-left: 16px;
}
.atable tr.flag td:first-child::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--red);
  box-shadow: 0 0 0 0 var(--red);
  animation: pulseGlow 2s var(--ease-out) infinite;
}
.atable tr.totals td { padding-top: 14px; border-bottom: 0; font-weight: 600; }
.atable tr.totals.strong td { font-size: 16px; }

.review-callout {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--red-bg);
  border-radius: var(--radius-2);
  font-size: 14px;
  color: var(--ink-1);
  line-height: 1.5;
  border-left: 3px solid var(--red);
}
.review-callout strong { font-weight: 600; }
.review-callout--ok {
  background: var(--green-subtle);
  border-left-color: var(--green);
  color: var(--ink-1);
}

.deck { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.slide {
  border: 1px solid var(--hair);
  border-radius: var(--radius-2);
  padding: 14px;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
  background: var(--bg-card);
  display: flex; flex-direction: column;
}
.slide__num { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.slide__title { font-size: 14px; font-weight: 500; margin-top: 6px; line-height: 1.35; color: var(--ink-1); }
.slide__by { font-size: 12px; color: var(--ink-3); margin-top: auto; padding-top: 10px; }
.slide.draft { border-style: dashed; }
.slide__live {
  position: absolute; top: 8px; right: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--green); font-weight: 600;
  background: var(--green-subtle);
  padding: 2px 7px; border-radius: 999px;
}
.slide__live::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--green); animation: pulseGlow 1.4s var(--ease-out) infinite; }

.action-bar {
  position: sticky; bottom: 0;
  display: flex; gap: 10px;
  padding: 16px 0 0;
  background: linear-gradient(to top, var(--bg-panel) 70%, transparent);
  margin-top: 24px;
}
.action-bar .btn { flex: 1; padding: 11px; font-size: 14px; justify-content: center; }

.panel__sheet-handle { display: none; }

/* home view */
.home-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.home-card {
  text-align: left;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--hair);
  border-radius: var(--radius-2);
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
  cursor: pointer;
}
.home-card:hover { background: var(--bg-elevated); border-color: var(--hair-strong); transform: translateY(-1px); }
.home-card .label { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.home-card .count { font-size: 22px; font-weight: 700; margin-top: 6px; color: var(--ink-1); }
.home-card .count span { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.home-card .row { display: flex; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.home-card .row span { display: inline-flex; gap: 5px; align-items: center; }

/* ============================================================
 * COMMAND PALETTE
 * ============================================================ */
.cmdk {
  position: fixed; inset: 0;
  display: none;
  align-items: flex-start; justify-content: center;
  padding-top: 14vh;
  z-index: 60;
  background: var(--bg-overlay);
  animation: cmdkIn var(--dur-2) var(--ease-out);
}
.cmdk.is-open { display: flex; }
@keyframes cmdkIn { from { opacity: 0; } to { opacity: 1; } }

.cmdk__box {
  width: min(560px, 90vw);
  background: var(--bg-popover);
  border-radius: 8px;
  box-shadow: var(--shadow-3);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 60vh;
  border: 1px solid var(--hair);
}
.cmdk__input {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hair);
}
.cmdk__input svg { width: 18px; height: 18px; color: var(--ink-3); }
.cmdk__input input { flex: 1; font-size: 15px; color: var(--ink-1); }
.cmdk__input input::placeholder { color: var(--ink-3); }
.cmdk__list { overflow-y: auto; max-height: 50vh; padding: 8px; }
.cmdk__row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  border-radius: 4px;
  color: var(--ink-2);
}
.cmdk__row.is-active { background: var(--bg-row-sel); color: var(--ink-1); }
.cmdk__row .pip { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--ink-4); }
.cmdk__row .pip[data-status="working"] { background: var(--green); }
.cmdk__row .pip[data-status="needs_decision"] { background: var(--red); }
.cmdk__row .pip[data-status="waiting"] { background: var(--yellow); }
.cmdk__row .name { flex: 1; }
.cmdk__row .where { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.cmdk__hint {
  display: flex; gap: 14px; padding: 8px 16px;
  font-size: 11px; color: var(--ink-3);
  border-top: 1px solid var(--hair);
  background: var(--bg-rail);
}
.kbd {
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 2px 6px; border-radius: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--hair-strong);
  color: var(--ink-2);
}

/* ============================================================
 * TOAST
 * ============================================================ */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(40px);
  background: var(--bg-tooltip); color: white;
  padding: 10px 16px; border-radius: var(--radius-2);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-3);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-out);
  z-index: 80;
  display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 32px);
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .check {
  width: 20px; height: 20px;
  border-radius: 50%; background: var(--green);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.toast .check svg { width: 12px; height: 12px; color: white; }

/* ============================================================
 * SCRIM (overlay backdrop for mobile drawers)
 * ============================================================ */
.scrim {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-2) var(--ease);
  z-index: 35;
  backdrop-filter: blur(2px);
}
.scrim.is-on { opacity: 1; pointer-events: auto; }

/* ============================================================
 * A11Y / MOTION
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.spacer { flex: 1; }

/* ============================================================
 * RESPONSIVE — last block wins source-order cascade
 * ============================================================ */

/* desktop: titlebar visible */
@media (min-width: 1100px) {
  .titlebar { display: flex; }
  .app { padding-top: var(--topbar-h); height: calc(100dvh - var(--topbar-h)); }
}

/* members panel only when shared thread + wide enough */
@media (min-width: 1280px) {
  .conv.has-members { display: grid; grid-template-columns: 1fr var(--members-w); grid-template-rows: 48px 1fr auto; grid-template-areas: "header header" "transcript members" "composer composer"; }
  .conv.has-members .conv__header { grid-area: header; }
  .conv.has-members .transcript { grid-area: transcript; }
  .conv.has-members .composer-wrap { grid-area: composer; }
  .conv.has-members .members.is-on { display: flex; grid-area: members; height: auto; }
}

/* tablet — collapse panel into overlay */
@media (max-width: 1280px) and (min-width: 981px) {
  .app { grid-template-columns: var(--server-w) var(--rail-w) 1fr 0; }
  .panel { display: none; }
  .panel.is-open {
    display: flex;
    position: fixed;
    inset: var(--topbar-h) 0 0 calc(var(--server-w) + var(--rail-w));
    z-index: 30;
    box-shadow: var(--shadow-3);
  }
  .conv__open-panel { display: inline-flex; }
}

/* mobile — single pane, drawers, bottom sheet */
@media (max-width: 980px) {
  body { overflow: auto; }
  .app {
    display: block;
    height: 100dvh;
    width: 100%;
  }
  .titlebar { display: none !important; }
  .server, .rail, .panel { display: none; }
  .conv {
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100dvh;
    width: 100%;
  }

  .rail.is-open {
    display: flex;
    position: fixed;
    inset: 0 56px 0 0;
    max-width: calc(100vw - 56px);
    z-index: 40;
    box-shadow: var(--shadow-3);
  }
  .rail.is-open + .scrim, .server.is-open + .scrim { /* shown via scrim is-on */ }

  .panel.is-open {
    display: flex;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 40;
    height: 86dvh;
    border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-3);
    border-left: 0;
  }
  .panel__sheet-handle {
    display: block;
    width: 36px; height: 4px;
    border-radius: 2px;
    background: var(--ink-4);
    margin: 8px auto 0;
  }
  .panel__sheet-handle + .panel__tabs { margin-top: 4px; }

  .conv__back { display: flex; }
  .conv__header { padding: 0 12px; }
  .conv__title { font-size: 16px; }
  .conv__crumb { display: none; }
  .conv__open-panel { display: inline-flex; padding: 6px 10px; }
  .composer-wrap { padding: 0 12px max(20px, env(safe-area-inset-bottom)); }
  .panel__body { padding: 18px 18px 90px; }
  .h1 { font-size: 22px; }
  .deck { grid-template-columns: 1fr; }
  .panel__close { display: flex; }

  /* turn padding tighter on mobile */
  .turn { padding: 2px 12px 2px 56px; margin: 0 -12px; }
  .turn .av { left: 12px; }
  .turn .meta .name { font-size: 14.5px; }
  .turn .text { font-size: 14.5px; }
}

@media (max-width: 380px) {
  .h1 { font-size: 20px; }
  .panel__body { padding: 14px 14px 80px; }
}

/* fonts ready hint */
.fonts-ready .turn .meta .name,
.fonts-ready .h1,
.fonts-ready .conv__title { letter-spacing: -0.015em; }
