#mode-bar button[aria-busy="true"] {
  cursor: progress;
  box-shadow: inset 0 -3px 0 currentColor;
}
:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #ecebed;
  background: #0b0b0d;
  --ink: #ecebed;
  --sender-color: #000;
  color-scheme: dark;
  --teal: #064b55;
  --brand-green: #23d18b;
  --accent: #8ac3ca;
  --teal-tint: var(--teal);
  --user-avatar-fill: #000;
  --user-avatar-ink: #fff;
  --own-avatar-fill: #000;
  --vi-avatar-fill: #000;
  --own-user-color: #ffad66;
  --line: #303036;
  --muted: #aaa7b1;
  --circle-surface: #0c0c10;
  --circle-divider: var(--line);
  --circle-border: var(--line);
  --highlight-edge: #23d18b38;
  --selected-circle: var(--teal-tint);
  --action-fill: var(--teal);
  --own-message-fill: transparent;
  --received-message-fill: transparent;
  --ai-message-fill: #19191d;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
.button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 14px;
  background: #19191d;
  color: var(--ink);
  min-height: 40px;
  text-decoration: none;
}
button:hover,
.button:hover {
  background: #28272e;
}
button:disabled {
  cursor: default;
  opacity: 0.65;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.primary {
  background: var(--action-fill);
  border-color: var(--highlight-edge);
  color: white;
}
.primary:hover {
  background: var(--teal);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.danger {
  color: #ff9bab;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 2px;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--circle-surface);
}
.brand {
  font-size: 29px;
  font-weight: 450;
  letter-spacing: -0.6px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-symbol {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.top-actions button {
  border: 0;
  background: transparent;
  font-size: 13px;
}
.mobile-icon { display: none; }
#connection-alert {
  position: fixed;
  z-index: 20;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #19191d;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 5px 18px #0005;
}
#connection {
  font-size: 12px;
  color: var(--ink);
}
#notice {
  position: fixed;
  z-index: 20;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 0;
  background: #28272e;
  color: white;
  border-radius: 10px;
  font-size: 13px;
}
#notice:not(:empty) {
  padding: 12px 20px;
}
body:has(#welcome:not([hidden])) {
  background: radial-gradient(ellipse at 85% 0%, var(--teal-tint), transparent 45%), #09090c;
}
body:has(#welcome:not([hidden])) .topbar {
  background: transparent;
  border-color: var(--line);
  padding-inline: clamp(24px, 3.6vw, 56px);
}
.startup-status { display: flex; align-items: center; gap: 16px; padding: 32px; }
.welcome {
  min-height: calc(100svh - 64px);
  max-width: 1536px;
  padding: 0 clamp(24px, 3.6vw, 56px);
  margin: auto;
  display: flex;
  flex-direction: column;
}
.landing-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.04fr);
  align-items: center;
  gap: clamp(30px, 5vw, 76px);
  padding: 64px 28px;
}
.landing-copy h1 {
  margin: 0 0 34px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 4.4vw, 68px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -2.6px;
  color: #faf8fb;
}
.landing-copy h1 span { color: var(--accent); }
.landing-copy > p {
  margin: 0 0 40px;
  max-width: 550px;
  font-size: clamp(17px, 1.56vw, 24px);
  line-height: 1.45;
}
#google-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 64px;
  padding: 14px 34px;
  border: 1px solid var(--highlight-edge);
  border-radius: 13px;
  background: var(--action-fill);
  font-size: 20px;
  font-weight: 400;
}
#google-signin:hover { background: var(--teal); box-shadow: inset 0 0 0 1px var(--accent); }
.google-mark { font-size: 29px; font-weight: 750; }
#fixture-accounts .button { display: inline-block; margin: 4px; }
.landing-preview {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--circle-surface);
  overflow: hidden;
  min-width: 0;
  box-shadow: 0 14px 55px #0003;
}
.preview-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}
.preview-brand { display: flex; align-items: center; gap: 8px; font-size: 26px; }
.preview-brand .brand-symbol { width: 25px; height: 25px; }
.preview-modes { display: flex; align-items: center; gap: 25px; font-size: 12px; color: var(--muted); }
.preview-modes span { padding: 13px 0 9px; }
.preview-modes .selected { color: var(--accent); border-bottom: 1px solid var(--accent); }
.preview-body { display: grid; grid-template-columns: 33.5% minmax(0, 1fr); }
.preview-circles { padding: 20px 12px; border-right: 1px solid var(--line); }
.preview-list-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 16px; }
.preview-list-title span:last-child { color: var(--accent); font-size: 11px; }
.preview-circle { padding: 16px 12px; margin-bottom: 7px; border: 1px solid var(--circle-border); border-radius: 9px; font-size: 13px; }
.preview-circle.selected { background: var(--selected-circle); border-color: var(--highlight-edge); }
.preview-conversation { min-width: 0; }
.preview-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 20px; font-size: 14px; }
.preview-heading span:last-child { color: var(--accent); font-size: 11px; }
.preview-account { font-size: 11px; color: var(--ink); }
.preview-conversation .preview-modes { display: flex; gap: 0; margin: 0 14px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; }
.preview-conversation .preview-modes span { flex: 1; text-align: center; padding: 7px 3px; font-size: 11px; }
.preview-conversation .preview-modes .selected { background: var(--teal); color: white; border: 0; border-radius: 8px; }
.preview-day { display: flex; align-items: center; gap: 8px; margin: 12px 18px 0; color: var(--muted); font-size: 9px; }
.preview-day::before, .preview-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.preview-attribution { display: inline; margin-left: 6px; color: var(--muted); font-size: 9px; }
.preview-privacy { display: inline-flex; vertical-align: middle; margin-left: 5px; color: var(--muted); }
.preview-privacy svg { width: 12px; height: 12px; }
.preview-messages { display: flex; flex-direction: column; gap: 8px; padding: 18px 18px 20px; }
.preview-message { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 0 8px; max-width: 95%; align-self: flex-start; }
.preview-avatar { grid-row: 1 / span 3; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--user-avatar-fill); color: var(--user-avatar-ink); font-size: 10px; font-weight: 700; }
.preview-message.own .preview-avatar { background: var(--own-avatar-fill); color: var(--user-avatar-ink); }
.preview-message.vi .preview-avatar { background: var(--vi-avatar-fill); }
.preview-message > .preview-sender, .preview-message > p, .preview-message > .preview-attribution { grid-column: 2; }
.preview-message.own { align-self: flex-start; }
.preview-sender { display: block; color: var(--sender-color); font-size: 11px; font-weight: 700; margin-bottom: 5px; }
.preview-message p { margin: 0; padding: 8px 11px; background: var(--received-message-fill); border: 0; border-radius: 11px; font-size: clamp(11px, .85vw, 12.5px); line-height: 1.4; }
.preview-message.own p { background: var(--own-message-fill); color: var(--ink); }
.preview-message.vi p { background: var(--ai-message-fill); }
.preview-time { margin-left: 8px; font-size: 9px; font-weight: 400; color: var(--muted); }

.preview-composer { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 10px; margin: 0 14px 14px; padding: 8px 10px 8px 16px; color: var(--muted); font-size: 13px; }
.preview-send { display: grid; place-items: center; width: 36px; height: 36px; background: var(--action-fill); border-radius: 50%; color: white; font-size: 20px; }
.landing-footer { display: flex; justify-content: center; align-items: center; gap: 5px; min-height: 74px; border-top: 1px solid var(--line); color: var(--muted); }
.landing-footer button { background: transparent; border: 0; font-size: 12px; color: var(--accent); min-height: 44px; }
.landing-footer button:hover { color: #fff; }
@media (max-width: 1150px) and (min-width: 900px) {
  .landing-main { padding-inline: 0; gap: 26px; }
  .preview-circles { padding-inline: 8px; }
  .preview-list-title { flex-wrap: wrap; }
  .preview-modes { gap: 15px; }
  .preview-heading { padding: 16px 12px; }
  .preview-messages { padding-inline: 12px; }
}
@media (max-width: 899px) {
  :root { --mobile-header-height: calc(56px + env(safe-area-inset-top)); }
  html:has(#workspace:not([hidden])) { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body:has(#workspace:not([hidden])) { position: fixed; inset: auto 0 auto 0; top: var(--app-viewport-top, 0px); width: 100%; height: var(--app-viewport-height, 100dvh); overflow: hidden; overscroll-behavior: none; }
  body:has(#workspace:not([hidden])) #app { height: 100%; display: flex; flex-direction: column; }
  .welcome { min-height: calc(100svh - var(--mobile-header-height)); }
  .landing-main { grid-template-columns: minmax(0, 1fr); gap: 42px; padding: 44px 0; max-width: 660px; width: 100%; margin: auto; }
  .landing-copy h1 { font-size: clamp(44px, 7.5vw, 68px); letter-spacing: -1.5px; margin-bottom: 24px; }
  .desktop-break { display: none; }
  .landing-copy > p { font-size: 18px; margin-bottom: 28px; }
  #google-signin { min-height: 56px; font-size: 17px; padding-inline: 24px; }
  .preview-message p { font-size: 12px; }
}
@media (max-width: 520px) {
  .preview-circles { display: none; }
  .preview-body { grid-template-columns: minmax(0, 1fr); }
  .preview-topbar { padding-inline: 12px; }
  .preview-brand { font-size: 21px; gap: 5px; }
  .preview-brand .brand-symbol { width: 21px; height: 21px; }
  .preview-modes { gap: 14px; font-size: 10px; }
  .preview-heading { padding: 16px; }
}
#workspace {
  font-size: 13px;
  --circle-surface: #101017;
  --own-message-fill: transparent;
  --received-message-fill: transparent;
  height: 100%;
  min-height: 0;
  width: 100%;
  margin: 0;
  border: 0;
  overflow: hidden;
  background: #101017;
  display: grid;
  grid-template-columns: 64px var(--sidebar-width, clamp(220px, 18vw, 260px)) minmax(0, 1fr);
}
#app-navigation { grid-column: 1; display: flex; flex-direction: column; gap: 8px; padding: 10px 4px max(8px, env(safe-area-inset-bottom)); background: #0c0c10; border-right: 1px solid var(--line); min-height: 0; overflow-y: auto; }
#app-navigation button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 56px; min-height: 56px; padding: 4px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; }
#app-navigation button:hover { background: #19191d; }
#app-navigation #nav-home { background: var(--teal); }
#app-navigation svg { width: 20px; height: 20px; flex: 0 0 20px; }
#rail-actions { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#app-navigation #navigation-actions { display: flex; flex-direction: column; flex: 1; gap: 8px; }
#app-navigation #account { order: 2; margin-top: auto; }
#app-navigation #account-name { max-width: 100%; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
#app-navigation #circle-info { min-height: 56px; height: auto; color: var(--ink); background: transparent; border: 0; }
#app-navigation .mobile-icon { display: block; }
#app-navigation .control-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; }
#circle-list { grid-column: 2; min-width: 0; }
#conversation { grid-column: 3; }
body:has(#workspace:not([hidden])) { overflow: hidden; }
body:has(#workspace:not([hidden])) #app {
  height: var(--app-viewport-height, 100dvh);
  display: flex;
  flex-direction: column;
}
body:has(#workspace:not([hidden])) #connection-alert,
body:has(#workspace:not([hidden])) #notice { top: calc(var(--app-viewport-top, 0px) + env(safe-area-inset-top) + 8px); }
#workspace-navigation .topbar {
  height: auto;
  padding: 0 0 12px;
  flex-wrap: wrap;
  gap: 0;
  background: transparent;
  margin-bottom: 10px;
}
#workspace-navigation .brand { font-size: 24px; width: 100%; }
#workspace-navigation .brand-symbol { width: 26px; height: 26px; }
#account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-icon { display: block; width: 20px; height: 20px; flex: 0 0 auto; }
#circle-info svg { width: 20px; height: 20px; flex: 0 0 20px; }
#sidebar-circle-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#sidebar-circle-actions:has(button:not([hidden])) { margin-bottom: 12px; }
#sidebar-circle-actions > button { min-height: 44px; }
#sidebar-circle-actions:empty { display: none; }
.circle-welcome { margin: 8px 0 16px; padding: 16px; max-width: 600px; border: 0; border-radius: 12px; background: var(--ai-message-fill); font-size: 13px; line-height: 1.5; }
.circle-welcome h2 { margin: 0 0 6px; font-size: 16px; }
.circle-welcome ul { padding-left: 20px; margin: 12px 0; }
.circle-welcome li { margin-block: 6px; }
.circle-welcome button { min-height: 44px; }
#conversation {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: transparent;
}
#conversation-tools { flex-shrink: 0; }
#reading-controls { display: none; }
.conversation-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 26px 8px;
}
.circle-heading {
  flex: 1;
  min-width: 0;
}
.circle-heading h1 {
  font-size: 18px;
  font-weight: 550;
  letter-spacing: -0.3px;
  margin: 5px 0;
  overflow-wrap: anywhere;
}
.circle-heading p {
  font-size: 12px;
  color: var(--muted);
  margin: 5px 0;
}
.conversation-header > button {
  font-size: 12px;
  color: var(--accent);
  background: transparent;
  border-color: var(--circle-border);
}
.conversation-header > button svg { width: 18px; height: 18px; flex: 0 0 auto; }
#circle-info { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 12px; background: var(--teal); color: var(--ink); }
#circle-info:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.mode-switch {
  display: flex;
  flex-shrink: 0;
  flex: 1 1 240px;
  width: 100%;
  max-width: 420px;
  min-width: 0;
  padding: 0;
  background: #19191d;
  border: 0;
  border-radius: 8px;
  gap: 2px;
}
.mode-switch button {
  flex: 1 1 0;
  min-width: 0;
  font-size: clamp(11px, 1.1vw, 13px);
  border: 0;
  border-radius: 8px;
  background: transparent;
  min-height: 44px;
  padding: 6px clamp(4px, 1.1vw, 12px);
  overflow-wrap: anywhere;
}
.mode-switch button[aria-pressed="true"] {
  background: var(--action-fill);
  color: white;
  font-weight: 650;
}
#mode-bar {
  padding: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}
#mode-bar > button {
  font-size: 12px;
  min-height: 32px;
  padding: 6px 10px;
}
#timeline {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 32px 8px;
  min-height: 100px;
  scrollbar-gutter: stable;
}
.mode-description { margin: 0; padding: 4px 32px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.private-exchange { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 0 10px; width: fit-content; max-width: 83%; margin: 8px 0; overflow-wrap: anywhere; }
.private-exchange > .sender, .private-exchange > .private-label, .private-exchange > .private-bubble { grid-column: 2; }
.private-exchange > .message-avatar { grid-row: 1 / span 2; }
.private-exchange .sender { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 2px; }
.private-label { font-size: 9px; color: var(--muted); margin-bottom: 2px; }
.private-visibility { position: relative; width: 18px; height: 18px; flex: 0 0 18px; align-self: center; }
.privacy-indicator { position: absolute; inset: -13px; width: 44px; height: 44px; min-height: 44px; padding: 15px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.privacy-indicator svg { width: 14px; height: 14px; flex: 0 0 14px; }
.privacy-indicator:hover { background: transparent; }
.vi-assistance { color: var(--muted); font-size: 9px; font-weight: 600; }
.privacy-tooltip { position: fixed; z-index: 60; max-width: calc(100vw - 16px); padding: 6px 9px; border-radius: 6px; background: #28272e; color: var(--ink); font-size: 11px; line-height: 1.45; pointer-events: auto; }

.private-exchange:not(.own) .private-bubble { background: var(--ai-message-fill); }
.sent-private-reply > summary { min-height: 44px; cursor: pointer; align-content: center; font-size: 11px; }
.sent-private-reply > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.private-bubble textarea { display: block; width: min(60vw, 520px); max-width: 100%; min-width: 180px; resize: vertical; background: transparent; color: var(--ink); border: 0; font: inherit; }
.private-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.private-actions button { background: transparent; font-size: 11px; padding: 4px 8px; min-height: 30px; }
.vi-working { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 12px; }
.working-dots { display: inline-flex; gap: 4px; align-items: center; }
.working-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-green); animation: vristy-working 1.2s ease-in-out infinite; }
.working-dots span:nth-child(2) { animation-delay: .15s; }
.working-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes vristy-working { 0%, 75%, 100% { opacity: .35; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-2px); } }
#private-composer { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; margin-bottom: 6px; }
#back-to-circle { background: transparent; font-size: 12px; min-height: 32px; padding: 4px 8px; }
#private-composer-error { font-size: 12px; color: var(--muted); }
.private-primary { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
#private-target { overflow-wrap: anywhere; }
#chat-invocation { margin-bottom: 6px; }
@media (max-width: 899px) {
  #copilot-hint { padding: 8px 16px; }
  .private-exchange { max-width: 91%; }
}
.empty {
  text-align: center;
  margin: 9vh auto;
  color: var(--muted);
  max-width: 380px;
}
.empty h2 {
  font-size: 21px;
  color: var(--ink);
  font-weight: 550;
}
.empty p {
  font-size: 14px;
  line-height: 1.7;
}
.empty-art {
  font-size: 48px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--teal-tint);
  width: 84px;
  height: 84px;
  border-radius: 30px;
  color: var(--accent);
}
.system-event {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  margin: 12px 0;
}
.day {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.4px;
  margin: 10px 0 12px;
}
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.day span { min-width: 78px; padding: 3px 14px; border: 1px solid var(--line); border-radius: 20px; text-align: center; background: #13131b; }
.day:first-child { margin-top: 0; }
.message {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  column-gap: 10px;
  width: fit-content;
  max-width: 83%;
  margin: 0;
  padding-top: 8px;
  overflow-wrap: anywhere;
}
.message.own { margin-left: 0; }
.message-content {
  display: grid;
  grid-template-columns: inherit;
  column-gap: inherit;
  grid-column: 1 / -1;
  min-width: 0;
}
.message-avatar, .circle-avatar { display: grid; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 700; color: white; }
.message-avatar { grid-column: 1; grid-row: 1 / span 2; width: 24px; height: 24px; background: var(--user-avatar-fill); font-size: 10px; color: var(--user-avatar-ink); margin-top: 1px; }
.own .message-avatar, .settings-avatar.own { background: var(--own-avatar-fill); color: var(--user-avatar-ink); }
.private-exchange:not(.own) > .message-avatar { background: var(--vi-avatar-fill); }
.message-content > .sender, .message-content > .bubble, .message-content > .message-reactions { grid-column: 2; min-width: 0; }
.message-content > .sender { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.message-time { font-size: 10px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.sender {
  font-size: 12px;
  font-weight: 700;
  color: var(--sender-color);
  margin: 0 0 3px;
}
.sender-name { color: var(--sender-color); font-weight: 700; }
.bubble, .private-bubble {
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 5px 10px;
  width: fit-content;
  max-width: 100%;
  white-space: pre-wrap;
  line-height: 1.4;
  font-size: 12.5px;
}
.formatted-message { white-space: normal; }
.formatted-message p { margin: 0 0 8px; white-space: pre-wrap; }
.formatted-message p:last-child, .formatted-message ul:last-child, .formatted-message ol:last-child { margin-bottom: 0; }
.formatted-message ul, .formatted-message ol { margin: 4px 0 6px; padding-left: 22px; }
.formatted-message li { margin: 3px 0; }
.formatted-message .formatted-heading { font-weight: 700; }
.formatted-message code { padding: 1px 4px; border-radius: 4px; background: #0003; font-size: .92em; }
.source-reference { font-size: .75em; margin-inline: 2px; color: var(--muted); }
.response-sources { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.response-sources .source-link { min-width: 44px; min-height: 44px; padding: 0 8px; font: inherit; color: var(--accent); background: transparent; border: 0; text-decoration: underline; }
.response-meta { font-size: 11px; color: var(--muted); }
.response-checked { margin-top: 6px; }
.bubble a, .private-bubble a { color: var(--accent); text-decoration: underline; overflow-wrap: anywhere; }
#decision-people label, #response-people label {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#permission-card { border-left: 2px solid var(--accent); padding-left: 12px; margin: 12px 0; }
.message.grouped {
  margin-top: 0;
  padding-top: 3px;
}
.message.grouped .sender, .message.grouped .message-avatar {
  display: none;
}
.message.grouped .bubble {
  border-radius: 10px;
}
.message-tools {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}
.own .message-tools {
  justify-content: flex-end;
}
.message-tools button {
  font-size: 10px;
  padding: 3px 6px;
  min-height: 24px;
  border: 0;
  background: transparent;
}
/* Attribution stays beside delivery, never below the message text. */
.message-metadata { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; color: var(--muted); font-size: 10px; font-weight: 400; }
.message.grouped[data-attributed] .message-content { grid-template-columns: 24px minmax(0, 1fr) auto; }
.message.grouped[data-attributed] .sender { display: flex; grid-column: 3; grid-row: 1; align-self: start; padding-top: 5px; margin: 0; }
.message.grouped[data-attributed] .sender-name, .message.grouped[data-attributed] .message-time { display: none; }
.message.grouped[data-attributed] .bubble { grid-column: 2; grid-row: 1; }
.message-reactions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.message-action-menu { position: fixed; z-index: 45; width: max-content; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; margin: 0; padding: 5px; border: 1px solid #45404c; border-radius: 11px; background: #19191d; box-shadow: 0 6px 22px #0007; gap: 4px; }
.message-action-menu button { display: flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; font-size: 0; }
.message-action-menu button:hover { background: #28272e; }
.message-action-menu button::before { content: attr(data-icon); font-size: 20px; }
.message-action-menu button[data-icon="copy"]::before, .message-action-menu button[data-icon="delete"]::before, .message-action-menu button[data-icon="vristy"]::before { content: none; }
.message-action-menu .action-icon { display: block; width: 20px; height: 20px; }
@media (min-width: 600px) and (any-hover: hover) {
  .message-action-menu { flex-direction: row; flex-wrap: nowrap; width: max-content; padding: 2px; }
  .message, .private-exchange { width: 100%; max-width: 100%; border-radius: 8px; }
  .message:hover, .private-exchange:hover, .message:focus-within, .private-exchange:focus-within { background: #ffffff08; }
  .message .bubble, .private-exchange .private-bubble { max-width: 83%; }
}
.message-reactions .reaction-chip { border: 1px solid var(--line); border-radius: 12px; padding: 3px 9px; min-height: 32px; background: transparent; color: var(--ink); font-size: 13px; }
.message-reactions .reaction-glyph { font-size: 13px; }
.message-reactions .reaction-chip[aria-pressed="true"] { border-color: #b6beca; color: var(--ink); }
.message-reactions .reaction-chip:hover { background: #28272e; }
.message-tools button, .message-reactions button { -webkit-touch-callout: none; user-select: none; }
.likes-popover { position: fixed; z-index: 50; width: max-content; min-width: 170px; max-width: min(280px, calc(100vw - 16px)); max-height: min(340px, calc(100dvh - 16px)); overflow-y: auto; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: #222026; color: var(--ink); box-shadow: 0 8px 26px #0008; font-size: 13px; }
.likes-popover-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.likes-popover-header button { padding: 2px 7px; min-height: 28px; background: transparent; border: 0; }
.likes-popover ul { margin: 6px 0 0; padding: 0; list-style: none; }
.likes-popover li { padding: 4px 0; overflow-wrap: anywhere; }
@media (pointer: coarse) { .message-action-menu button, .message-reactions .reaction-chip, .message-tools .add-reaction, .likes-popover button { min-height: 44px; } }
.quote {
  background: transparent;
  border: 0;
  padding: 6px 8px;
  white-space: pre-wrap;
  font-size: 12px;
  margin-bottom: 8px;
}
.deleted .bubble {
  font-style: italic;
  color: var(--muted);
  background: var(--received-message-fill);
}
.timeline-controls {
  position: relative;
  display: flex;
  flex: 0 0 0;
  height: 0;
  min-height: 0;
  gap: 4px;
  justify-content: flex-end;
  padding: 0 12px;
  overflow: visible;
  background: transparent;
  border: 0;
  z-index: 3;
  pointer-events: none;
}
.timeline-controls button {
  position: absolute;
  bottom: 8px;
  left: 12px;
  flex-shrink: 0;
  pointer-events: auto;
  font-size: 11px;
  padding: 5px 9px;
  min-height: 44px;
  border: 0;
  background: transparent;
}
#jump { left: 50%; right: auto; transform: translateX(-50%); display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: #19191d; }
#jump:hover { background: #28272e; }
#jump svg { width: 20px; height: 20px; }
#composer {
  position: relative;
  margin: 0;
  padding: 6px 32px 8px;
  background: transparent;
}
/* Presence and the disclaimer share one compact row. Its fixed height keeps
   incoming typing from moving the draft or conversation reading anchor. */
#typing-indicator { min-height: 14px; margin: 0 3px; color: var(--muted); font-size: 10px; line-height: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; pointer-events: none; }
.timeline-controls:not(:has(#jump:not([hidden]), #unread-threads:not([hidden]))) {
  display: none;
}
@media (min-width: 900px) {
  .conversation-header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding-top: 4px; padding-bottom: 0; }
  .mode-switch { max-width: 360px; }
  .circle-heading { position: absolute; }
  #mode-bar { flex: 1 1 300px; }
  .circle-heading h1 { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.compose-row {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 12px;
  align-items: center;
  padding: 4px 8px;
  background: var(--circle-surface);
  gap: 8px;
}
.compose-row textarea {
  resize: none;
  background: transparent;
  color: var(--ink);
  flex: 1;
  border: 0;
  padding: 6px;
  min-height: 44px;
  min-width: 0;
  max-height: 140px;
}
.compose-row textarea:focus-visible {
  outline-offset: 0;
}
.compose-row button {
  min-height: 42px;
}
.compose-row #send { padding: 8px 16px; min-height: 44px; }
#pending:empty { display: none; }
#retention-notice { margin: 2px 32px; }
#reply-context,
#pending {
  padding: 5px 32px;
  font-size: 12px;
  color: var(--muted);
}
#reply-context button,
#pending button {
  font-size: 11px;
  min-height: 26px;
  padding: 4px 8px;
}
#circle-list {
  border-right: 1px solid var(--circle-divider);
  padding: 16px 16px;
  overflow: auto;
  background: transparent;
  position: relative;
}
.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.list-heading h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 5px 0;
}
#new-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 10px;
  min-height: 44px;
  font-size: 14px;
}
.create-plus { font-size: 26px; font-weight: 300; line-height: 1; }
.onboarding-steps {
  text-align: left;
  padding-left: 24px;
  margin: 24px 0;
}
.onboarding-steps li { padding: 6px 0 6px 6px; }
.onboarding-steps strong { display: block; color: var(--ink); }
.onboarding-steps span, .onboarding-invite { font-size: 13px; }
#find-circle {
  width: 100%;
  padding: 12px 13px 12px 39px;
  border: 1px solid var(--circle-border);
  border-radius: 9px;
  background: var(--circle-surface);
  font-size: 12px;
}
.circle-search { position: relative; }
.circle-search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.list-options {
  display: flex;
  justify-content: space-between;
  margin: 5px 0 10px;
}
.list-options button {
  font-size: 10px;
  border: 0;
  min-height: 28px;
  padding: 4px;
  background: transparent;
  color: var(--muted);
}
.circle-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 12px;
  column-gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--circle-border);
  background: var(--circle-surface);
  border-radius: 12px;
  margin: 6px 0;
  padding: 13px 10px;
  min-height: 76px;
}
.circle-row:hover {
  background: #19191d;
  border-color: var(--accent);
}
.circle-row.selected {
  background: var(--selected-circle);
  border-color: var(--accent);
}
.circle-row.selected p, .circle-row.selected small { color: #c3c0c9; }
.circle-avatar { grid-column: 1; grid-row: 1 / span 3; width: 36px; height: 36px; align-self: center; background: #000; }
.circle-chevron { grid-column: 3; grid-row: 1 / span 3; align-self: center; font-size: 25px; color: var(--accent); }
.circle-row .row-top, .circle-row p, .circle-row small { grid-column: 2; min-width: 0; }
.circle-row .row-top { grid-row: 1; }
.circle-row p { grid-row: 2; }
.circle-row small { grid-row: 3; }
.circle-row .row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
}
.circle-row strong {
  font-size: 13px;
  font-weight: 550;
  overflow-wrap: anywhere;
}
.circle-row small {
  font-size: 10px;
  color: var(--muted);
}
.circle-row p {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 0;
}
.unread {
  background: var(--teal);
  color: white;
  border-radius: 10px;
  min-width: 19px;
  display: inline-block;
  text-align: center;
  padding: 2px 5px;
  font-size: 10px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  width: min(580px, calc(100vw - 28px));
  max-height: calc(100dvh - 40px);
  padding: 25px;
  background: #101012;
  color: var(--ink);
  box-shadow: 0 30px 100px #00000066;
  overflow: auto;
}
dialog::backdrop {
  background: #00000099;
}
.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  margin-bottom: 18px;
}
.dialog-header h2 {
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.6px;
}
.dialog-header button {
  font-size: 23px;
  border: 0;
  padding: 3px 10px;
  min-height: 38px;
}
dialog label {
  font-size: 12px;
  font-weight: 650;
  display: block;
  margin: 16px 0 7px;
}
dialog textarea,
dialog input,
dialog select {
  width: 100%;
  border: 1px solid #424048;
  border-radius: 8px;
  padding: 11px;
  background: #19191d;
  resize: vertical;
}
dialog button {
  margin: 5px 5px 5px 0;
  font-size: 12px;
}
dialog p {
  line-height: 1.65;
  font-size: 13px;
}
dialog fieldset {
  border: 1px solid var(--line);
  border-radius: 9px;
  margin: 18px 0;
  padding: 10px;
}
dialog legend {
  font-size: 12px;
}
.account-dialog { width: min(580px, calc(100vw - 24px)); }
.settings-dialog { width: min(660px, calc(100vw - 24px)); padding: 22px; overscroll-behavior: contain; }
.settings-dialog .dialog-header { margin-bottom: 16px; position: sticky; top: -22px; z-index: 2; background: #101012; padding: 12px 0; margin-top: -12px; }
.settings-dialog .dialog-header button { min-width: 44px; min-height: 44px; margin: 0; }
.settings-section { background: #141419; border: 1px solid #343039; border-radius: 12px; padding: 16px; margin: 12px 0; min-width: 0; }
.settings-section h3 { margin: 0 0 10px; font-size: 14px; scroll-margin-top: 96px; }
.settings-section p { margin: 8px 0; overflow-wrap: anywhere; }
.settings-section label { margin-top: 12px; }
.settings-dialog button { min-height: 44px; max-width: 100%; white-space: normal; }
.settings-actions, .settings-nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.settings-actions button { margin: 0; padding: 8px 10px; }
.settings-nav { margin-bottom: 16px; }
.settings-nav button { margin: 0; background: transparent; color: var(--accent); }
.circle-summary { display: flex; gap: 12px; align-items: center; padding: 2px 0 10px; }
.circle-summary > div { min-width: 0; }
.circle-summary strong { font-size: 18px; overflow-wrap: anywhere; }
.circle-summary p { color: var(--muted); margin: 4px 0 0; }
.settings-avatar { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; background: var(--user-avatar-fill); color: var(--user-avatar-ink); font-size: 12px; font-weight: 700; }
.settings-avatar.own { background: var(--own-avatar-fill); color: var(--user-avatar-ink); }
.settings-section .member-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 0; padding: 10px 0; }
.member-identity { flex: 1; min-width: 110px; overflow-wrap: anywhere; }
.member-role { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.blocked-person { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.blocked-person strong { font-size: 13px; overflow-wrap: anywhere; }
.earlier-invitations { margin-top: 10px; color: var(--muted); font-size: 12px; }
.earlier-invitations summary { cursor: pointer; padding: 12px 0; min-height: 44px; }
dialog .ai-processing-note { color: var(--muted); font-size: 11px; line-height: 1.5; }
@media (max-width: 599px) {
  .settings-dialog { padding: 16px; max-height: calc(100dvh - 24px); }
  .settings-dialog .dialog-header { top: -16px; }
  .settings-section { padding: 13px; }
  .member-row .settings-actions { width: 100%; padding-left: 48px; }
}
.account-identity { margin: 4px 0 22px; overflow-wrap: anywhere; }
.account-identity strong { font-size: 20px; }
.account-identity p { margin: 5px 0 0; color: var(--muted); }
.account-section { background: #141419; border: 1px solid #343039; border-radius: 12px; padding: 16px; margin: 12px 0; }
.account-section h3 { margin: 0 0 12px; font-size: 14px; }
.account-section label { margin-top: 10px; }
.account-section .account-save { display: block; margin: 12px 0 0 auto; border-color: var(--highlight-edge); }
.account-section .account-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; margin: 4px 0; padding: 11px 12px; text-align: left; background: transparent; border: 0; min-height: 44px; }
.account-section .account-link:hover { background: #28272e; }
.account-link span { font-size: 22px; color: var(--muted); }
.account-footer { margin-top: 20px; }
.account-footer .account-signout { display: block; width: 100%; margin: 0; min-height: 44px; background: #ae2636; border-color: #c94351; color: #fff; font-weight: 650; }
.account-footer .account-signout:hover { background: #c03242; }
dialog fieldset label {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
}
dialog fieldset input {
  width: auto;
}
#task-actions label { min-height: 44px; }
.private-note {
  background: #19191d;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}
.two-fields {
  display: flex;
  gap: 12px;
}
.two-fields > label {
  flex: 1;
  min-width: 0;
}
.error,
#dialog-error,
#luna-error {
  color: #ff9bab;
  font-size: 13px;
  line-height: 1.6;
}
.member-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.member-row strong {
  display: block;
  font-size: 13px;
}
.draft-card,
.agreement-card {
  border: 1px solid #424048;
  border-radius: 12px;
  padding: 14px;
  margin-top: 20px;
}
.message-content > .shared-decision { grid-column: 2; min-width: 0; margin-top: 8px; }
.shared-decision p { margin: 6px 0; overflow-wrap: anywhere; }
.shared-decision .private-primary { align-items: flex-start; }
.shared-decision button { min-height: 44px; }
.draft-card textarea {
  margin-top: 8px;
}
.badge {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
}
.receipt {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  font-size: 12px;
}
.mobile-only {
  display: none;
}
.unread-divider {
  text-align: center;
  font-size: 11px;
  color: var(--accent);
  margin: 20px 0;
  padding: 8px;
}
.fixture-note {
  padding: 15px;
  border: 1px dashed #77717f;
  margin: 25px 0;
  color: var(--muted);
  font-size: 12px;
}
#job-state,
#task-state {
  font-size: 13px;
  line-height: 1.65;
  margin-top: 14px;
}
#job-state:empty,
#task-state:empty {
  display: none;
}
@media (max-width: 899px) {
  .topbar {
    height: var(--mobile-header-height);
    padding: env(safe-area-inset-top) 12px 0;
    gap: 8px;
    flex-shrink: 0;
  }
  .brand-note {
    display: none;
  }
  .top-actions {
    min-width: 0;
    gap: 4px;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }
  .top-actions button {
    font-size: 12px;
    min-height: 44px;
    padding: 8px 10px;
  }
  .mobile-icon { display: block; width: 20px; height: 20px; }
  #help { display: flex; align-items: center; justify-content: center; width: 44px; flex: 0 0 44px; }
  #help .control-label, #circle-info .control-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #account { min-width: 44px; max-width: min(38vw, 180px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #workspace {
    height: auto;
    flex: 1;
    min-height: 0;
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
  }
  #app-navigation { grid-area: 1 / 1; padding-top: calc(10px + env(safe-area-inset-top)); }
  #circle-list { grid-area: 1 / 2; }
  #conversation {
    height: 100%;
    grid-area: 1 / 1 / 2 / -1;
    padding-top: env(safe-area-inset-top);
  }
  #timeline, #circle-list { overscroll-behavior: none; touch-action: pan-y pinch-zoom; overflow-x: hidden; }
  #timeline { min-height: 0; }
  .conversation-header, #composer { flex-shrink: 0; }
  #circle-list {
    height: 100%;
    border: 0;
    padding: calc(16px + env(safe-area-inset-top)) 12px 12px;
  }
  .mobile-only {
    display: block;
  }
  .conversation-header {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    padding: 6px 12px 0;
    gap: 6px 8px;
  }
  #back { grid-area: 1 / 1; width: 44px; min-height: 44px; border: 0; padding: 0; }
  .circle-heading { grid-area: 1 / 2; }
  .circle-heading h1 {
    font-size: 16px;
    line-height: 1.25;
    margin: 0;
    max-height: 2.5em;
    overflow: hidden;
  }
  .conversation-header > button {
    font-size: 10px;
    padding: 8px;
  }
  #mode-bar {
    grid-area: 2 / 1 / 3 / -1;
    padding: 0;
    min-width: 0;
    gap: 6px;
    flex-wrap: wrap;
  }
  .mode-switch { display: flex; width: 100%; max-width: 420px; min-width: 0; padding: 0; border-radius: 8px; }
  .mode-switch button {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 6px 8px;
  }
  #mode-bar > button { min-height: 44px; }
  #circle-info { grid-area: 1 / 3; width: 44px; min-height: 44px; padding: 0; gap: 0; border: 0; }
  #circle-info svg { width: 20px; height: 20px; }
  #copilot-hint { padding: 5px 16px 4px; font-size: 11px; line-height: 1.45; }
  #timeline {
    padding: 6px 16px 8px;
  }
  .message {
    max-width: 91%;
  }
  #composer {
    padding: 6px 16px calc(8px + env(safe-area-inset-bottom));
    max-height: 55%;
    overflow-y: auto;
  }
  .compose-row textarea { font-size: 16px; min-height: 44px; }
  body.mobile-header-hidden .topbar, body.mobile-header-hidden #conversation-tools { display: none; }
  body.mobile-composer-hidden #composer { display: none; }
  #reading-controls:not([hidden]) { display: flex; flex-shrink: 0; gap: 8px; align-items: center; padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); }
  #show-conversation-tools { width: 44px; min-height: 44px; flex-shrink: 0; }
  #write-message { min-height: 44px; min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 5px 12px; font-size: 12px; }
  #reading-context { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
  body.mobile-keyboard-open .topbar, body.mobile-compact-height .topbar { display: none; }
  body.mobile-keyboard-open #copilot-hint, body.mobile-compact-height #copilot-hint { display: none; }
  body.mobile-keyboard-open #composer, body.mobile-compact-height #composer { padding: 4px 12px calc(4px + env(safe-area-inset-bottom)); }
  body.mobile-keyboard-open .compose-row, body.mobile-compact-height .compose-row { padding: 4px 8px; }
  body.mobile-keyboard-open .conversation-header, body.mobile-compact-height .conversation-header { padding-top: 2px; }
  body.mobile-header-hidden #conversation, body.mobile-keyboard-open #conversation, body.mobile-compact-height #conversation { padding-top: env(safe-area-inset-top); }
  body.mobile-compact-height #circle-list { padding-top: calc(25px + env(safe-area-inset-top)); }
  body.mobile-header-hidden #connection-alert, body.mobile-keyboard-open #connection-alert, body.mobile-compact-height #connection-alert,
  body.mobile-header-hidden #notice, body.mobile-keyboard-open #notice, body.mobile-compact-height #notice { top: calc(var(--app-viewport-top, 0px) + env(safe-area-inset-top) + 4px); }
  @media (max-height: 450px) {
    body:has(#workspace:not([hidden])) .topbar { display: none; }
    .conversation-header { padding-top: 2px; gap: 2px 6px; }
    #copilot-hint { display: none; }
    #composer { padding: 4px 12px calc(4px + env(safe-area-inset-bottom)); }
    .compose-row { padding: 4px 8px; }
  }
  .compose-row button {
    min-height: 44px;
  }
  #reply-context,
  #pending {
    padding: 6px 16px;
    max-height: 18%;
    overflow-y: auto;
    flex-shrink: 0;
  }
  #pending:empty { display: none; }
  dialog {
    padding: 20px;
    max-height: calc(var(--app-viewport-height, 100dvh) - 24px);
    top: calc(var(--app-viewport-top, 0px) + var(--app-viewport-height, 100dvh) / 2);
    bottom: auto;
    margin-block: 0;
    transform: translateY(-50%);
  }
  dialog.settings-dialog { max-height: calc(var(--app-viewport-height, 100dvh) - 24px); }
  .two-fields {
    display: block;
  }
  #notice {
    top: calc(var(--mobile-header-height) + 4px);
  }
  #connection-alert { top: calc(var(--mobile-header-height) + 4px); }
  .topbar .brand {
    font-size: 21px;
  }
  .brand-symbol {
    width: 24px;
    height: 24px;
    font-size: 24px;
  }
  .topbar .brand { gap: 6px; }
}
/* Keep phone tabs full width without stretching them across medium windows. */
@media (max-width: 599px) {
  .mode-switch { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .working-dots span { animation: none; opacity: .7; }
  * {
    scroll-behavior: auto !important;
  }
}

@font-face {
  font-family: "Vristy Emoji";
  src: url("/static/emoji/NotoColorEmoji.ttf") format("truetype");
  font-display: swap;
}
.reaction-glyph { font-family: "Vristy Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 17px; }
#dialog.reaction-dialog { width: min(420px, calc(100vw - 24px)); padding: 16px; }
.reaction-dialog #dialog-content { overflow: hidden; }
emoji-picker {
  width: 100%; height: min(420px, calc(100dvh - 150px));
  --emoji-font-family: "Vristy Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --background: #17161b; --border-color: var(--line); --border-radius: 10px;
  --button-hover-background: var(--line); --button-active-background: var(--teal-tint);
  --input-font-color: #ecebed; --input-border-color: #81788d;
  --indicator-color: var(--accent); --outline-color: var(--accent);
  --num-columns: 8;
}
@media (max-width: 400px) { emoji-picker { --num-columns: 7; } }

.avatar-colors { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.avatar-color { display: grid; place-items: center; width: 48px; height: 48px; padding: 4px; border: 2px solid transparent; background: transparent; }
.avatar-color[aria-pressed="true"] { border-color: var(--accent); }
.avatar-color .settings-avatar { width: 34px; height: 34px; }
.message-avatar.avatar-style-orange, .settings-avatar.avatar-style-orange { background: #ffad66; color: #17202b; }
.message-avatar.avatar-style-green, .settings-avatar.avatar-style-green { background: #23d18b; color: #17202b; }
.message-avatar.avatar-style-blue, .settings-avatar.avatar-style-blue { background: #9ec5ff; color: #17202b; }
.message-avatar.avatar-style-teal, .settings-avatar.avatar-style-teal { background: #8ac3ca; color: #17202b; }
.message-avatar.avatar-style-purple, .settings-avatar.avatar-style-purple { background: #cbb0ff; color: #17202b; }
.message-avatar.avatar-style-pink, .settings-avatar.avatar-style-pink { background: #ffb0d2; color: #17202b; }
.message-avatar.avatar-style-red, .settings-avatar.avatar-style-red { background: #ff9999; color: #17202b; }
.message-avatar.avatar-style-gold, .settings-avatar.avatar-style-gold { background: #ffd56b; color: #17202b; }
.message-avatar.avatar-style-lime, .settings-avatar.avatar-style-lime { background: #c4e878; color: #17202b; }
.message-avatar.avatar-style-cyan, .settings-avatar.avatar-style-cyan { background: #8ee8ee; color: #17202b; }
.message-avatar.avatar-style-slate, .settings-avatar.avatar-style-slate { background: #b9c3d1; color: #17202b; }
.message-avatar.avatar-style-cream, .settings-avatar.avatar-style-cream { background: #eee2c4; color: #17202b; }
.message-avatar.avatar-style-sunset, .settings-avatar.avatar-style-sunset { background: linear-gradient(135deg,#ffd56b,#ff9999); color: #17202b; }
.message-avatar.avatar-style-ocean, .settings-avatar.avatar-style-ocean { background: linear-gradient(135deg,#8ee8ee,#9ec5ff); color: #17202b; }
.message-avatar.avatar-style-forest, .settings-avatar.avatar-style-forest { background: linear-gradient(135deg,#c4e878,#23d18b); color: #17202b; }
.message-avatar.avatar-style-berry, .settings-avatar.avatar-style-berry { background: linear-gradient(135deg,#ffb0d2,#cbb0ff); color: #17202b; }
.message-avatar.avatar-style-rainbow, .settings-avatar.avatar-style-rainbow { background: linear-gradient(135deg,#ff9999,#ffd56b,#c4e878,#9ec5ff,#cbb0ff); color: #17202b; }
.message-avatar.avatar-style-aurora, .settings-avatar.avatar-style-aurora { background: linear-gradient(135deg,#23d18b,#8ee8ee,#cbb0ff); color: #17202b; }
.message-avatar.avatar-style-candy, .settings-avatar.avatar-style-candy { background: linear-gradient(135deg,#ffb0d2,#8ee8ee); color: #17202b; }
.message-avatar.avatar-style-fire, .settings-avatar.avatar-style-fire { background: linear-gradient(135deg,#ffd56b,#ffad66,#ff9999); color: #17202b; }

/* Flat replies share ordinary message formatting; only their position/context differ. */
.message.thread-reply { margin-left: 20px; }
.thread-reply .quote { color: var(--muted); font-size: 11px; padding: 0 0 3px; }
.thread-controls { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.thread-controls > button { max-width: 100%; }
.thread-toggle { color: var(--accent); background: transparent; border: 0; font-size: 11px; padding: 0 8px; min-height: 44px; }
@media(max-width:599px) { .message.thread-reply { margin-left: 12px; } }
#unread-threads { min-height: 44px; }

.timeline-controls { flex-wrap: wrap; }

.search-result {overflow-wrap:anywhere; padding:8px 0;}
.search-result p {white-space:pre-wrap; margin:4px 0;}

#search-messages svg {width:20px; height:20px; flex:0 0 20px;}
@media (max-width:899px) {
  .conversation-header {grid-template-columns:44px minmax(0,1fr) 44px 44px;}
  #search-messages {grid-area:1/3; width:44px; min-height:44px; padding:0; border:0;}
  #search-messages .control-label {position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap;}
  #circle-info {grid-area:1/4;}
}

#composer {position:relative;}
#mention-suggestions {position:fixed; z-index:40; width:min(320px,calc(100vw - 16px)); max-height:220px; overflow-y:auto; background:var(--ai-message-fill); border:1px solid var(--line); border-radius:8px; padding:4px;}
#mention-suggestions button {display:block; width:100%; min-height:44px; text-align:left; background:transparent; border:0; overflow-wrap:anywhere;}
#mention-suggestions [aria-selected="true"] {background:#064b55;color:white;}
.mention {color:var(--accent);}

.edit-mention-choices{display:flex;flex-direction:column;max-height:176px;overflow-y:auto}.edit-mention-choices[hidden]{display:none}.edit-mention-choices button[aria-selected="true"]{background:var(--teal,#064b55)}

.delivery-status{color:var(--muted,#aaa);font-size:10px;white-space:nowrap}

/* Chat has its own light palette; surrounding black/teal navigation is unchanged. */
#conversation {
  --ink: #172c33;
  --sender-color: #101b20;
  --muted: #52666c;
  --line: #d0d0d0;
  --accent: #075f6b;
  --circle-surface: #f8f8f8;
  --circle-border: #d0d0d0;
  --ai-message-fill: #ececec;
  --chat-identity-surface: #eeeeee;
  color-scheme: light;
  color: var(--ink);
  background: #f3f3f3;
}
#conversation .bubble, #conversation .private-bubble { color: var(--ink); }
#conversation button { background: transparent; color: var(--ink); }
#conversation button:hover { background: #e6e6e6; }
#conversation .primary, #conversation .primary:hover,
#conversation .mode-switch button[aria-pressed="true"] {
  background: var(--teal);
  color: white;
}
#conversation .danger { color: #9a253c; }
#conversation .message-action-menu { background: #f8f8f8; border-color: var(--line); }
#conversation .message:hover, #conversation .private-exchange:hover,
#conversation .message:focus-within, #conversation .private-exchange:focus-within { background: #eeeeee; }
#conversation .privacy-indicator:hover { background: transparent; }
#conversation textarea::placeholder { color: var(--muted); }

/* Keep rail labels inside the rail and let the sidebar divider overlap its border. */
#app-navigation { overflow-x: hidden; }
#app-navigation button { width: 100%; min-width: 0; max-width: 100%; }
#app-navigation #account-name { overflow: hidden; }
#app-navigation, #circle-list, #conversation { grid-row: 1; }
#sidebar-resize {
  grid-column: 2; grid-row: 1; justify-self: end; align-self: stretch;
  position: relative; z-index: 10; width: 12px; margin-right: -6px;
  cursor: col-resize; touch-action: none; user-select: none;
}
#sidebar-resize::after { content: ""; position: absolute; inset: 0 5px; background: var(--line); }
#sidebar-resize:hover::after, #sidebar-resize:focus-visible::after { background: var(--accent); }
body.sidebar-resizing, body.sidebar-resizing * { cursor: col-resize !important; user-select: none !important; }
@media (max-width: 899px) { #sidebar-resize { display: none; } }

.activity-actions { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.activity-actions button { min-height: 44px; }

/* Chat search stays at the pane's right edge; sidebar search covers all circles. */
#conversation #search-messages { width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
@media (min-width: 900px) {
  #conversation .conversation-header { position: relative; padding-right: max(64px, var(--conversation-inset, 26px)); }
  #conversation #search-messages { position: absolute; top: 4px; right: 12px; }
}
@media (max-width: 899px) {
  #search-messages { grid-area: 1 / 4; }
  #circle-info { grid-area: 1 / 3; }
}
button.search-result-hit { display: block; width: 100%; text-align: left; padding: 16px; margin: 12px 0; min-height: 44px; background: #101017; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; }
button.search-result-hit:hover { background: #28272e; border-color: #6c9298; }
button.search-result-hit:focus-visible { outline-color: var(--accent); }
.search-hit-circle { display: block; width: fit-content; max-width: 100%; margin-bottom: 8px; padding: 3px 8px; border-radius: 5px; background: var(--teal); color: white; font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.search-hit-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; line-height: 1.4; }
.search-hit-author { color: var(--ink); font-size: 14px; font-weight: 750; overflow-wrap: anywhere; }
.search-hit-time, .search-hit-reply { color: var(--muted); font-size: 11px; }
.search-hit-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.55; }
.search-hit-text mark { background: #ffe69a; color: #111; font-weight: 700; border-radius: 2px; padding: 0 1px; }
#conversation .message.search-hit { background: #d5d5d5; outline: 2px solid var(--accent); outline-offset: -2px; }

/* Direct messages share the existing timeline; only identity/navigation differs. */
#direct-section { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
#direct-section h2 { font-size: 18px; margin: 0 0 8px; }
.direct-avatar { background: #000; color: #fff; border-radius: 50%; }
#direct-context { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 26px; color: var(--muted); background: #19191d; font-size: 12px; }
#direct-context button { min-height: 44px; background: transparent; color: var(--accent); border: 0; padding: 0 8px; }
button.identity-link { display: inline; background: transparent; border: 0; border-radius: 3px; padding: 0; margin: 0; min-height: 0; color: inherit; font-weight: inherit; text-align: inherit; cursor: pointer; }
button.identity-link:hover, button.identity-link:focus-visible { background: transparent; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
button.identity-link:focus-visible { outline: 2px solid var(--accent); }
button.sender-name { color: var(--ink); font-weight: 750; }
.member-name { font-weight: 750; }
button.identity-avatar { display: grid; place-items: center; padding: 0; margin: 0; border: 0; border-radius: 50%; min-height: 0; background: transparent; }
button.identity-avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.message-avatar-link { grid-column: 1; grid-row: 1 / span 2; width: 24px; height: 24px; margin-top: 1px; }
.message-avatar-link > .message-avatar { margin-top: 0; }
.message.grouped .message-avatar-link { display: none; }
.settings-avatar-link { flex: 0 0 38px; width: 38px; height: 38px; }
#conversation button.identity-link, #conversation button.identity-link:hover { background: transparent; }

/* Mobile conversation identity and conventional details navigation. */
.mobile-circle-identity { display: none; }
/* Conversation controls share the original dark neutral palette. */
#conversation { --chat-chrome-surface: #101017; --chat-identity-surface: #19191d; }
#conversation-tools { background: var(--chat-chrome-surface); border-bottom: 1px solid var(--line); }
#composer, #reading-controls { background: var(--chat-chrome-surface); border-top: 1px solid var(--line); }
#conversation #mode-bar { gap: 4px; }
#conversation .mode-switch { flex: 1 1 300px; max-width: 532px; background: var(--chat-identity-surface); box-shadow: inset 0 0 0 1px var(--line); }
#conversation .mode-switch button { white-space: nowrap; overflow-wrap: normal; padding-inline: clamp(4px, 1vw, 8px); }
#conversation #open-luna { flex: 0 0 auto; min-width: 44px; min-height: 44px; font-size: clamp(10px, 1vw, 11px); padding: 4px 6px; white-space: nowrap; border: 1px solid var(--line); border-radius: 8px; background: var(--circle-surface); }
#conversation #open-luna:hover { background: var(--chat-identity-surface); }
/* Preserve full mode labels beside the 44px settings control on narrow phones. */
@media (max-width: 280px) {
  #conversation .mode-switch button[data-mode] { padding-inline: 1px; }
}
.ai-settings-short { display: none; }
@media (max-width: 599px) {
  .ai-settings-label { display: none; }
  .ai-settings-short { display: inline; }
}
@media (max-width: 899px) {
  #notice { pointer-events: none; }
  #back { font-size: 23px; line-height: 1; }
  #conversation .conversation-header { grid-template-columns: 44px minmax(0, 1fr) 44px; padding: 4px max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); gap: 4px; }
  .conversation-header .circle-heading { display: none; }
  #conversation #circle-info { grid-area: 1 / 2; width: 100%; min-width: 0; min-height: 48px; padding: 4px 8px; border: 0; border-radius: 14px; background: var(--chat-identity-surface); color: var(--ink); }
  #circle-info > svg, #circle-info > .control-label { display: none; }
  #circle-info .mobile-circle-identity { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 2px 8px; width: 100%; min-width: 0; text-align: left; }
  #circle-header-avatar { grid-area: 1 / 1 / 3 / 2; width: 32px; height: 32px; font-size: 12px; color: #fff; background: #000; }
  .circle-header-text { display: contents; }
  #circle-header-name { grid-area: 1 / 2; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; line-height: 1.25; font-weight: 700; }
  #circle-header-meta { grid-area: 2 / 1 / 3 / -1; display: block; padding-inline: 40px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; color: var(--muted); font-size: 11px; line-height: 1.25; font-weight: 400; }
  #search-messages { grid-area: 1 / 3; }
  body.mobile-header-hidden #conversation-tools { display: block; }
  body.mobile-header-hidden #mode-bar, body.mobile-header-hidden #copilot-hint { display: none; }
  #dialog.circle-details-dialog { position: fixed; inset: var(--app-viewport-top, 0px) 0 auto; width: 100%; max-width: none; height: var(--app-viewport-height, 100dvh); max-height: 100dvh; margin: 0; border: 0; border-radius: 0; padding: 0; transform: none; overflow: hidden; overscroll-behavior: contain; }
  #dialog.circle-details-dialog .dialog-header { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 8px; flex: 0 0 auto; position: static; margin: 0; padding: calc(8px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); background: #101012; z-index: 2; }
  #dialog.circle-details-dialog[open] { display: flex; flex-direction: column; }
  #dialog.circle-details-dialog #dialog-content { min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain; padding: 0 max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  #dialog.circle-details-dialog #dialog-error:empty { margin: 0; }
  #dialog.circle-details-dialog .dialog-header h2 { grid-area: 1 / 2; font-size: 18px; margin: 0; overflow-wrap: anywhere; }
  #dialog.circle-details-dialog #close-dialog { grid-area: 1 / 1; width: 44px; min-height: 44px; margin: 0; padding: 0; }
}

.autopilot-private { max-width: 760px; margin: 12px 8px; padding: 12px; border: 1px solid var(--line, #555); border-radius: 10px; background: #19191d; color: var(--ink); overflow-wrap: anywhere; }
.autopilot-private p { margin: 5px 0; }
.autopilot-private h3 { font-size: 1rem; margin: 8px 0; }
.autopilot-coming-soon { text-align: center; padding: 12px 12px 24px; }
.autopilot-coming-soon-mark { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 20px; border: 1px solid #a5c7cc; border-radius: 24px; color: #064b55; background: #edf5f6; }
.autopilot-coming-soon-mark span { font-size: 42px; line-height: 1; animation: autopilot-arrival 1.6s ease-in-out 2; }
.autopilot-coming-soon .autopilot-coming-soon-eyebrow { color: var(--muted); font-size: 12px; margin: 0 0 8px; }
.autopilot-coming-soon h3 { margin: 0 0 12px; font-size: clamp(28px, 6vw, 38px); font-weight: 650; letter-spacing: -.04em; }
.autopilot-coming-soon p:last-child { max-width: 30ch; margin: 0 auto; line-height: 1.6; }
@keyframes autopilot-arrival { 0%, 100% { transform: rotate(0deg) scale(1); opacity: 1; } 50% { transform: rotate(90deg) scale(.8); opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .autopilot-coming-soon-mark span { animation: none; } }
.autopilot-status { font-weight: 600; }
.autopilot-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.autopilot-actions button, .autopilot-private summary { min-height: 44px; }
.autopilot-private details { margin-top: 4px; }
.autopilot-private summary { cursor: pointer; display: flex; align-items: center; }
.autopilot-private.autopilot-running { width: fit-content; max-width: min(760px, 100%); padding-block: 6px; }
.autopilot-running .autopilot-status { margin-top: 2px; }
.autopilot-running details { margin-top: 0; }
.autopilot-running summary { padding-block: 0; }
.autopilot-private button { max-width: 100%; white-space: normal; }
.autopilot-private summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 599px) { .autopilot-private { margin: 8px 0; padding: 10px; } }

/* Personal settings and contextual task editing share one bounded surface.
   The conversation, tabs and composers keep their existing geometry. */
#dialog.ai-settings-surface, #luna-dialog.task-editor-dialog {
  width: min(660px, calc(100vw - 24px)); max-height: calc(var(--app-viewport-height, 100dvh) - 32px);
  padding: 0; overflow: hidden; overscroll-behavior: contain;
}
#dialog.ai-settings-surface[open], #luna-dialog.task-editor-dialog[open] { display: flex; flex-direction: column; }
#dialog.ai-settings-surface .dialog-header, #luna-dialog.task-editor-dialog .dialog-header {
  position: static; flex: 0 0 auto; margin: 0; padding: 16px 20px 8px; background: #101012;
}
.ai-settings-surface .dialog-header h2, .task-editor-dialog .dialog-header h2 { font-size: 21px; }
#dialog.ai-settings-surface #dialog-content, #luna-dialog.task-editor-dialog #autopilot-panel {
  min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 20px;
}
.settings-scope { flex: 0 0 auto; padding: 0 20px 12px; border-bottom: 1px solid var(--line); }
.settings-scope label { margin: 6px 0; }
.settings-scope select { padding: 8px 10px; }
.settings-footer { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: #101012; }
.settings-footer[hidden] { display: none; }
.settings-footer button { min-height: 44px; margin: 0; }
.settings-footer [role="status"] { width: 100%; margin: 0; overflow-wrap: anywhere; }
.settings-footer [role="status"]:empty { display: none; }
button.settings-row { display: grid; grid-template-columns: minmax(0, 1fr) 24px; width: 100%; text-align: left; min-height: 72px; padding: 13px 12px; gap: 5px 10px; margin: 8px 0; border-color: var(--line); }
.settings-row strong { font-size: 14px; }
.settings-row .hint { grid-column: 1; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.settings-row .settings-chevron { grid-column: 2; grid-row: 1 / 3; align-self: center; justify-self: end; font-size: 24px; }
.ai-settings-surface .settings-back { min-height: 44px; margin-bottom: 10px; }
.preference-field { margin-bottom: 18px; }
.preference-field > p { margin: 6px 0; }
.preference-field > button { margin: 2px 0; }
.settings-origin-action { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.settings-origin-action button { min-height: 44px; margin: 0; }
.settings-source-mode { min-width: 0; margin: 18px 0; padding: 0; border: 0; }
.settings-source-mode legend { font-weight: 650; padding: 0; margin-bottom: 10px; }
.ai-settings-surface details, .task-editor-dialog details { margin: 14px 0; }
.ai-settings-surface summary, .task-editor-dialog summary { cursor: pointer; min-height: 44px; padding: 12px 0; font-weight: 650; }
.ai-settings-surface input[type="checkbox"], .task-editor-dialog input[type="checkbox"] { width: 20px; min-height: 20px; flex: 0 0 20px; }
.settings-discard { border: 1px solid var(--accent); padding: 12px; margin-bottom: 12px; }
.task-editor-dialog > p, .task-editor-dialog > #gathering-progress, .task-editor-dialog > #task-brief { display: none; }
#task-editor-navigation { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
#task-editor-navigation .settings-row { margin: 0; min-height: 74px; grid-template-columns: minmax(0,1fr); }
#task-editor-navigation button[aria-expanded="true"] { border-color: var(--accent); }
#task-editor-sections > section { margin-top: 20px; }
#task-editor-sections h3 { margin: 0 0 8px; }
.task-editor-dialog #luna-error { order: 2; margin: 0; padding: 0 20px; max-height: 72px; overflow-y: auto; }
.task-editor-dialog #luna-error:empty { padding: 0; }
.task-editor-dialog #task-editor-footer { order: 3; }
@media(max-width:599px) {
  #dialog.ai-settings-surface, #luna-dialog.task-editor-dialog {
    position: fixed; inset: var(--app-viewport-top,0px) 0 auto; margin: 0; width: 100%; max-width: none;
    height: var(--app-viewport-height,100dvh); max-height: 100dvh; border: 0; border-radius: 0; transform: none;
  }
  #dialog.ai-settings-surface .dialog-header, #luna-dialog.task-editor-dialog .dialog-header { padding: calc(8px + env(safe-area-inset-top)) 16px 8px; }
  #dialog.ai-settings-surface #dialog-content, #luna-dialog.task-editor-dialog #autopilot-panel { padding-right: max(16px,env(safe-area-inset-right)); padding-left: max(16px,env(safe-area-inset-left)); }
  .settings-scope { padding-right: 16px; padding-left: 16px; }
  .settings-footer { padding: 10px max(16px,env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); }
  .ai-settings-surface input, .ai-settings-surface textarea, .ai-settings-surface select,
  .task-editor-dialog input, .task-editor-dialog textarea, .task-editor-dialog select { font-size: 16px; }
}

/* Private answer metadata retains its own readable inset. */
#conversation .private-bubble .private-note {
  background: #101017;
  color: var(--muted);
  border-color: var(--line);
  padding: 8px;
}

/* Shared popup surface. Keep headings and close controls outside body scrolling. */
dialog {
  --ink: #ecebed;
  --muted: #aaa7b1;
  --line: #303036;
  --accent: #8ac3ca;
  color-scheme: dark;
  color: var(--ink);
  background: #101017;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(var(--app-viewport-height, 100dvh) - 40px);
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 64px #15252e30;
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #0009; }
dialog .dialog-header,
#dialog.settings-dialog .dialog-header,
#dialog.circle-details-dialog .dialog-header,
#dialog.ai-settings-surface .dialog-header,
#luna-dialog.task-editor-dialog .dialog-header {
  position: static; flex: 0 0 auto; margin: 0;
  padding: 18px 24px; background: #101017; border-bottom: 1px solid var(--line);
}
dialog .dialog-header h2 { font-size: 20px; line-height: 1.3; letter-spacing: -.3px; overflow-wrap: anywhere; }
dialog .dialog-header button {
  flex: 0 0 44px; width: 44px; min-height: 44px; margin: 0; padding: 0;
  background: transparent; border: 0; color: var(--muted); font-size: 25px;
}
#dialog-content, #luna-content {
  min-width: 0; min-height: 0; flex: 1 1 auto; overflow-y: auto;
  overscroll-behavior: contain; padding: 20px 24px;
}
#dialog.settings-dialog, #dialog.reaction-dialog { padding: 0; }
#dialog.circle-details-dialog #dialog-content,
#dialog.ai-settings-surface #dialog-content { padding: 20px 24px; }
#luna-dialog.task-editor-dialog #autopilot-panel { padding: 0; overflow: visible; flex: none; }
.task-editor-dialog #luna-content > p,
.task-editor-dialog #luna-content > #gathering-progress,
.task-editor-dialog #luna-content > #task-brief { display: none; }
dialog label { font-size: 13px; margin: 18px 0 8px; }
dialog label:first-child { margin-top: 0; }
dialog input, dialog textarea, dialog select {
  background: #101017; color: var(--ink); border-color: #55515d;
  font-size: 14px; line-height: 1.55; min-height: 44px; padding: 11px 12px;
}
dialog textarea { min-height: 120px; max-height: min(420px, 52dvh); field-sizing: content; }
dialog button { min-height: 44px; font-size: 13px; background: #19191d; color: var(--ink); }
dialog button:hover, dialog .account-link:hover { background: #28272e; }
dialog button.primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 650; }
dialog button.primary:hover { background: #064b55; }
dialog .danger, dialog .error { color: #ff9bab; }
dialog button.danger { border-color: #743b46; background: #30191f; }
dialog .account-signout { background: #ae2636; color: #fff; }
dialog p { font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
dialog .hint, dialog .ai-processing-note { color: var(--muted); font-size: 12px; }
dialog .settings-section, dialog .account-section, dialog .private-note { background: #19191d; border-color: var(--line); }
dialog .settings-footer { background: #101017; }
dialog .settings-footer, dialog .settings-scope { padding-inline: 24px; }
#dialog-error, #luna-error, .task-editor-dialog #luna-error {
  flex: 0 0 auto; max-height: 96px; overflow-y: auto; margin: 0;
  padding: 12px 24px; border-top: 1px solid #743b46; background: #30191f; color: #ff9bab;
}
#dialog-error:empty, #luna-error:empty { display: none; }
.dialog-actions {
  position: sticky; bottom: -20px; display: flex; flex: 0 0 auto; flex-wrap: wrap;
  justify-content: flex-end; gap: 10px; margin: 24px -24px -20px;
  padding: 16px 24px; border-top: 1px solid var(--line); background: #101017; z-index: 1;
}
.dialog-actions button { margin: 0; min-width: 100px; }
#dialog.edit-message-dialog { width: min(800px, calc(100vw - 32px)); }
.edit-message-dialog textarea { min-height: min(300px, 38dvh); max-height: min(500px, 52dvh); }
dialog emoji-picker {
  --background: #101017; --input-font-color: #ecebed; --input-border-color: #55515d;
  --category-font-color: #aaa7b1; --button-hover-background: #28272e;
  --button-active-background: #064b55;
  height: min(420px, calc(var(--app-viewport-height, 100dvh) - 150px));
}
@media (max-width: 599px) {
  dialog { max-height: calc(var(--app-viewport-height, 100dvh) - 24px); }
  dialog .dialog-header, #dialog.settings-dialog .dialog-header,
  #dialog.circle-details-dialog .dialog-header, #dialog.ai-settings-surface .dialog-header,
  #luna-dialog.task-editor-dialog .dialog-header { padding: 12px 16px; }
  #dialog-content, #luna-content, #dialog.circle-details-dialog #dialog-content,
  #dialog.ai-settings-surface #dialog-content { padding: 16px; }
  dialog input, dialog textarea, dialog select { font-size: 16px; }
  dialog .settings-footer, dialog .settings-scope { padding-inline: 16px; }
  .dialog-actions { bottom: -16px; margin-inline: -16px; margin-bottom: -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  #dialog.edit-message-dialog {
    inset: var(--app-viewport-top, 0px) 0 auto; width: 100%; max-width: none;
    height: var(--app-viewport-height, 100dvh); max-height: 100dvh;
    margin: 0; transform: none; border: 0; border-radius: 0;
  }
  .edit-message-dialog textarea { min-height: min(260px, 38dvh); }
  #dialog.edit-message-dialog #dialog-content { display: flex; flex-direction: column; }
  .edit-message-dialog .dialog-actions { margin-top: auto; }
}
.copilot-provenance, .public-lookup-audit { margin-block: 6px; font-size: 12px; }
.copilot-provenance > summary, .public-lookup-audit > summary,
.planning-status > summary { min-height: 44px; cursor: pointer; align-content: center; }
.public-lookup-review p { margin-block: 6px; }

/* Workspace redesign: original black/teal palette, new component geometry.
   Keep IDs, state selectors, touch targets and viewport/reading behavior intact. */
.preview-conversation {
  --ink: #000; --sender-color: #000; --muted: #5f6368; --line: #dadde3;
  --accent: #075f6b; --circle-surface: #fff; --circle-border: #dadde3;
  --ai-message-fill: #f5f5f5; color-scheme: light; color: #000; background: #fff;
}
#workspace { background: #0b0b0d; }
#app-navigation {
  background: #0c0c10; border: 0; padding-inline: 6px; gap: 12px;
}
#app-navigation button {
  min-height: 54px; border-radius: 16px; gap: 5px;
  color: var(--muted); font-size: 10px; font-weight: 550; letter-spacing: .15px;
}
#app-navigation svg { width: 21px; height: 21px; }
#app-navigation button:hover, #app-navigation button:focus-visible { color: var(--ink); background: #19191d; }
#app-navigation #nav-home { color: white; background: var(--teal); }
#app-navigation #account { border-radius: 50%; }
#app-navigation #circle-info { color: var(--muted); min-height: 54px; }
#app-navigation #navigation-actions { gap: 12px; }
#circle-list { padding: 24px 14px 16px; border-right: 0; background: #0b0b0d; }
#workspace-navigation .topbar { border: 0; padding: 0; margin-bottom: 28px; }
#workspace-navigation .brand { font-size: 25px; font-weight: 650; letter-spacing: -1px; gap: 7px; }
#workspace-navigation .brand-symbol { width: 23px; height: 23px; }
.list-heading { margin: 0 4px 14px; }
.list-heading h2, #direct-section h2 { font-size: 11px; font-weight: 650; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
#new-circle { border-radius: 14px; min-height: 44px; font-size: 12px; font-weight: 650; margin-bottom: 18px; }
.create-plus { font-size: 21px; }
#find-circle { border: 0; border-radius: 12px; background: #19191d; min-height: 44px; color: var(--ink); }
#find-circle::placeholder { color: var(--muted); }
.list-options { margin: 6px 2px 16px; }
.list-options button { min-height: 32px; font-size: 10px; }
.circle-row {
  position: relative; grid-template-columns: 40px minmax(0, 1fr) 8px;
  column-gap: 10px; padding: 14px 10px; margin: 5px 0;
  min-height: 84px; border: 0; border-radius: 16px; background: transparent;
}
.circle-row:hover { background: #19191d; }
.circle-row.selected { background: var(--teal); }
.circle-row.selected::after { content: ""; position: absolute; right: 0; top: 24px; width: 3px; height: 28px; border-radius: 3px 0 0 3px; background: var(--accent); }
.circle-avatar { width: 40px; height: 40px; border-radius: 13px; background: #19191d; font-size: 12px; }
.circle-row.selected .circle-avatar { background: #0c0c10; }
.circle-row strong { font-size: 13px; font-weight: 400; letter-spacing: -.15px; }
.circle-row.selected strong { font-weight: 650; }
.circle-row p { margin-top: 5px; line-height: 1.4; }
.circle-row small { font-size: 9px; line-height: 1.5; }
.circle-chevron { font-size: 17px; color: var(--muted); }
.circle-row.selected .circle-chevron { color: var(--accent); }
.unread { min-width: 18px; border-radius: 6px; font-size: 9px; font-weight: 700; }
.circle-row.selected .unread { background: #0c0c10; }
#direct-section { padding-top: 22px; margin-top: 22px; border-top: 1px solid #222026; }
#sidebar-resize::after { background: transparent; }
/* Owner-approved sage chat, matching the desktop/mobile review image. */
#conversation { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
#conversation-tools { border-bottom: 1px solid var(--line); background: #eeeeee; }
#conversation .mode-switch { background: #f8f8f8; border: 1px solid #cdcdcd; border-radius: 12px; padding: 0; gap: 3px; box-shadow: none; }
#conversation .mode-switch button { border-radius: 9px; border: 0; font-size: 12px; font-weight: 550; min-height: 44px; color: var(--muted); }
#conversation .mode-switch button:hover { background: #eeeeee; color: var(--ink); }
#conversation .mode-switch button[aria-pressed="true"] { background: var(--teal); color: #fff; font-weight: 700; }
#conversation #open-luna { background: transparent; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); padding: 6px 12px; }
#conversation #open-luna:hover { background: #f8f8f8; }
#conversation #circle-info, #conversation #search-messages, #conversation #back { border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
#conversation #circle-info:hover, #conversation #search-messages:hover, #conversation #back:hover { background: #dedede; color: var(--ink); box-shadow: none; }
#copilot-hint { padding-block: 0 2px; font-size: 10px; }
#timeline { padding-top: 18px; }
#conversation .day { justify-content: center; margin-bottom: 18px; gap: 12px; }
#conversation .day::before, #conversation .day::after { display: block; }
#conversation .day span { min-width: 68px; padding: 6px 16px; background: #f8f8f8; border: 1px solid var(--line); font-size: 11px; text-transform: none; letter-spacing: 0; }
.system-event { font-size: 10px; margin-block: 10px; }
.unread-divider { font-size: 10px; margin-block: 14px; }
#conversation .message, #conversation .private-exchange { grid-template-columns: 32px minmax(0, 1fr); column-gap: 12px; border-radius: 12px; }
#conversation .message { padding-top: 16px; }
#conversation .message.grouped { padding-top: 3px; }
#conversation .message-content { grid-template-columns: 32px minmax(0, 1fr); }
#conversation .message.grouped[data-attributed] .message-content { grid-template-columns: 32px minmax(0, 1fr) auto; }
#conversation .message-avatar, #conversation button.message-avatar-link { width: 32px; height: 32px; border-radius: 50%; font-size: 11px; }
#conversation .message-avatar:not([class*="avatar-style-"]) { background: #dedede; color: var(--ink); }
#conversation .private-exchange:not(.own) > .message-avatar { background: #e1e1e1; color: #075f6b; font-size: 25px; }
#conversation .sender, #conversation .sender-name, #conversation button.sender-name { color: var(--sender-color); font-size: 12px; font-weight: 700; }
#conversation .bubble { padding: 5px 0; line-height: 1.55; }
#conversation .private-bubble { padding: 5px 0; border-radius: 0; background: transparent; line-height: 1.55; }
#conversation .vristy-card .private-bubble { max-width: none; padding-block: 2px; }
#conversation .message-time, #conversation .message-metadata { font-size: 10px; }
.vristy-card { grid-column: 2; min-width: 0; width: fit-content; max-width: 100%; padding: 8px 12px; border: 1px solid #d8d8d8; border-radius: 14px; background: var(--ai-message-fill); }
.vristy-card > .sender { margin-bottom: 0; }
#conversation .vristy-card .sent-private-reply > summary { min-height: 24px; }
.vristy-suggestion { margin-left: auto; border-radius: 20px; background: #dedede; color: #07515b; padding: 4px 10px; font-size: 10px; font-weight: 550; align-self: center; }
#conversation .message-reactions .reaction-chip { border: 1px solid var(--line); border-radius: 16px; background: #f8f8f8; }
#conversation .message-reactions .reaction-chip[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--accent); }
#conversation .message-action-menu { border: 1px solid var(--line); border-radius: 12px; padding: 4px; background: #f8f8f8; box-shadow: 0 5px 18px #172c3326; }
#conversation .message-action-menu button { border: 0; border-radius: 8px; }
#conversation .autopilot-private { border-radius: 14px; border: 1px solid #d8d8d8; padding: 14px 16px; background: var(--ai-message-fill); }
#conversation .autopilot-private button, #conversation .private-actions button { border-radius: 10px; min-height: 44px; }
#retention-notice { font-size: 10px; line-height: 1.4; color: var(--muted); margin-block: 4px 0; }
#composer { background: transparent; border-top: 0; padding-block: 4px 18px; }
#composer-disclaimer { margin: 0 0 1px; color: var(--muted); font-size: 8px; line-height: 10px; text-align: center; }
.composer-status { display: grid; height: 12px; margin-bottom: 1px; align-items: center; }
.composer-status > p { grid-area: 1 / 1; }
.composer-status #typing-indicator { min-height: 0; margin: 0 3px; line-height: 12px; }
.composer-status #typing-indicator:empty { visibility: hidden; }
.composer-status #composer-disclaimer { margin: 0; line-height: 12px; }
.composer-status:has(#typing-indicator:not(:empty)) #composer-disclaimer { opacity: 0; }
#conversation .compose-row { align-items: flex-end; padding: 5px; border-radius: 16px; background: #f8f8f8; border: 1px solid #cdcdcd; gap: 6px; }
#conversation .compose-row:focus-within { border-color: var(--accent); }
#conversation .compose-row textarea { padding: 10px 12px; font-size: 13px; line-height: 1.5; border-radius: 10px; background: transparent; }
#conversation .compose-row textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#conversation .compose-row #send { border: 0; border-radius: 11px; font-size: 12px; font-weight: 650; min-height: 44px; padding-inline: 16px; }
#conversation #use-copilot { display: grid; place-items: center; flex: 0 0 44px; width: 44px; min-height: 44px; border: 0; border-radius: 50%; background: #e5e5e5; color: #075f6b; padding: 11px; }
#use-copilot svg { width: 22px; height: 22px; }
#conversation #use-copilot:hover { background: #d8d8d8; }
#conversation .privacy-tooltip, #conversation #jump, #conversation .likes-popover { background: #f8f8f8; color: var(--ink); border-color: var(--line); }
#private-composer { font-size: 10px; padding-inline: 4px; }
#back-to-circle { border: 0; color: var(--accent); }
#reading-controls { background: #eeeeee; border-top: 1px solid var(--line); }
#write-message { border-radius: 12px; }
#direct-context { background: #eeeeee; border-bottom: 1px solid var(--line); font-size: 10px; }
#conversation #direct-context button { color: var(--accent); }
/* Details and settings share an editorial layout, with fewer nested boxes. */
dialog { border-radius: 24px; border-color: #3b3841; box-shadow: 0 24px 80px #0008; }
dialog .dialog-header, #dialog.settings-dialog .dialog-header,
#dialog.circle-details-dialog .dialog-header, #dialog.ai-settings-surface .dialog-header,
#luna-dialog.task-editor-dialog .dialog-header { padding-block: 22px; border-bottom: 0; }
dialog .dialog-header h2 { font-size: 22px; font-weight: 650; letter-spacing: -.6px; }
dialog .dialog-header button { border-radius: 50%; background: #19191d; font-size: 21px; }
dialog .settings-section, dialog .account-section { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 20px 0; margin: 0; }
dialog .settings-section h3, dialog .account-section h3 { font-size: 12px; font-weight: 650; letter-spacing: .1px; margin-bottom: 14px; }
dialog button { border-radius: 12px; border-color: transparent; }
dialog input, dialog textarea, dialog select { background: #19191d; border: 1px solid #55515d; border-radius: 12px; }
dialog button.settings-row { border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-block: 10px; }
.settings-row .settings-chevron { color: var(--muted); font-size: 20px; }
.circle-summary { padding: 0 0 24px; gap: 14px; align-items: center; }
.circle-summary > .settings-avatar { width: 56px; height: 56px; flex-basis: 56px; border-radius: 18px; font-size: 16px; background: #19191d; }
.circle-summary strong { font-size: 24px; font-weight: 650; letter-spacing: -.5px; }
.circle-summary p { font-size: 11px; margin-top: 6px; }
.settings-avatar, .settings-avatar-link { border-radius: 12px; }
.account-identity { padding-bottom: 18px; }
.account-identity strong { font-size: 25px; letter-spacing: -.6px; }
.account-section .account-link { padding-inline: 0; border-radius: 10px; }
.member-row .settings-actions button { font-size: 11px; padding-inline: 10px; }
.settings-section .member-row { padding-block: 12px; }
.settings-nav button { border-radius: 20px; }
button.search-result-hit { border-radius: 16px; padding: 18px; margin-block: 10px; }
.search-hit-circle { border-radius: 6px; font-size: 10px; }
.search-hit-author { color: var(--ink); font-size: 13px; }
.search-hit-time, .search-hit-reply { color: var(--muted); }
#dialog-error, #luna-error { border-radius: 0; }
@media (min-width: 900px) {
  #conversation { margin: 12px 12px 12px 4px; }
  #conversation .conversation-header {
    display: grid; grid-template-columns: minmax(0, 1fr) 44px;
    grid-template-rows: 18px auto; gap: 2px 12px; padding: 2px 28px;
  }
  .conversation-header .circle-heading { grid-area: 1 / 1; position: static; }
  .circle-heading h1 { position: static; width: auto; height: auto; padding: 0; margin: 0; clip-path: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 650; letter-spacing: -.15px; }
  #conversation #circle-info { grid-area: 1 / 2; min-height: 44px; width: 44px; padding: 0; }
  #circle-info > .control-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #conversation #search-messages { grid-area: 1 / 2 / 3 / 3; position: static; align-self: start; }
  #conversation #mode-bar { grid-area: 2 / 1; width: 100%; flex-wrap: wrap; gap: 8px; }
  #conversation .mode-switch { flex: 1 1 240px; min-width: 174px; max-width: 380px; }
  #conversation #open-luna { margin-left: auto; }
  #timeline, #composer, #copilot-hint, #pending, #reply-context { padding-inline: 28px; }
  #retention-notice { margin-inline: 28px; }
  #dialog.settings-dialog:has(.circle-summary) { position: fixed; inset: 12px 12px 12px auto; margin: 0; width: min(480px, calc(100vw - 24px)); height: calc(100dvh - 24px); max-height: none; transform: none; }
}
@media (max-width: 899px) {
  #circle-list { padding-top: calc(24px + env(safe-area-inset-top)); }
  #conversation { border: 0; border-radius: 0; }
  #conversation .conversation-header { padding: 2px max(12px, env(safe-area-inset-right)) 2px max(12px, env(safe-area-inset-left)); gap: 2px; }
  #conversation #circle-info { position: relative; border-radius: 0; padding: 4px 24px 4px 4px; min-height: 44px; background: transparent; color: var(--ink); }
  #circle-info > svg { display: block; position: absolute; right: 4px; top: 15px; width: 14px; height: 14px; color: var(--muted); }
  #circle-header-avatar { border-radius: 11px; }
  #circle-header-name { font-size: 15px; font-weight: 650; letter-spacing: -.3px; }
  #circle-header-meta { color: var(--muted); text-align: left; font-size: 10px; padding-left: 40px; }
  #conversation #mode-bar { gap: 8px; }
  #conversation .mode-switch { max-width: 420px; }
  #timeline { padding: 12px 20px 8px; }
  #composer { padding: 2px 12px calc(12px + env(safe-area-inset-bottom)); }
  #retention-notice { margin-inline: 20px; font-size: 9px; }
  .compose-row { border-radius: 18px; padding: 5px; }
  .compose-row textarea { font-size: 16px; padding: 10px 9px; }
  #conversation .compose-row #send { padding-inline: 13px; }
  #dialog.circle-details-dialog .dialog-header { padding-block: calc(14px + env(safe-area-inset-top)) 14px; }
  #dialog.circle-details-dialog #close-dialog { border-radius: 50%; background: #19191d; }
  #dialog.circle-details-dialog .dialog-header h2 { font-size: 18px; }
}
@media (max-width: 599px) {
  #conversation .mode-switch { max-width: none; }
  dialog { border-radius: 22px; }
  dialog .dialog-header, #dialog.settings-dialog .dialog-header,
  #dialog.ai-settings-surface .dialog-header, #luna-dialog.task-editor-dialog .dialog-header { padding-block: 16px; }
  dialog .dialog-header h2 { font-size: 20px; }
  .circle-summary strong { font-size: 22px; }
}
@media (max-height: 450px) and (max-width: 899px) {
  #conversation .conversation-header { padding-block: 2px; gap: 2px; }
  #conversation .mode-switch { padding: 0; }
  #composer { padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
}

/* Keep compact screens and the existing keyboard/reading states in control. */
@media (max-width: 899px) {
  #conversation .compose-row textarea { font-size: 16px; min-height: 44px; }
  #conversation #circle-header-avatar { width: 32px; height: 32px; border-radius: 50%; }
  #conversation #circle-header-meta { grid-area: 2 / 2; padding: 0; text-align: left; }
  #conversation .mode-switch { max-width: none; }
  #conversation .private-exchange { max-width: 100%; }
  .vristy-card { padding: 8px 10px; }
  #conversation .compose-row #send { padding-inline: 12px; }
}
@media (max-width: 359px) {
  #conversation .message, #conversation .private-exchange { column-gap: 8px; }
  #conversation .compose-row { gap: 4px; }
  #conversation .compose-row textarea { padding-inline: 7px; }
}

/* v0.881 catch-up: a complete visible paragraph and a small unique-people row. */
#catchup-title { margin:4px 0; font-size:14px; line-height:1.4; }
#catchup-content { overflow-wrap:anywhere; }
#catchup-content .catchup-summary { margin:6px 0; line-height:1.55; white-space:normal; }
#catchup .catchup-reply-link { min-width:44px; min-height:44px; padding:6px 8px; border:0; background:transparent; color:#064b55; font-size:12px; }
.catchup-mentions { display:flex; flex-wrap:wrap; align-items:center; gap:2px 6px; margin-top:4px; }
.catchup-mentions strong { font-size:12px; font-weight:600; }
.catchup-others { color:#505b5e; font-size:12px; }

/* v0.89 shared discovery and public headlines; existing chat/rail themes stay intact. */
.news-message .vristy-card { max-width:min(720px,100%); }
.news-message h3 { margin:0 0 4px; font-size:14px; line-height:1.4; }
.news-message ol { list-style:none; margin:0; padding:0; }
.news-message li { margin:0; padding:5px 0; }
.news-message li+li { border-top:1px solid #80808020; }
.news-message-link { display:block; color:inherit; text-decoration:none; font-weight:500; line-height:1.45; overflow-wrap:anywhere; }
.news-message-link:hover { text-decoration:underline; text-underline-offset:3px; }
.news-message-link:focus-visible { outline:2px solid #064b55; outline-offset:2px; }
.news-message-source { display:block; color:var(--muted); font-size:11px; line-height:1.4; margin-top:1px; }
@media(pointer:coarse) { .news-message-link { min-height:44px; display:flex; align-items:center; } }
.headlines-list { min-width:0; }
.headlines-list ol { list-style:none; padding:0; margin:0; }
.headline-row { padding:8px 0; margin:0; border-bottom:1px solid #80808030; }
.headline-title { display:flex; align-items:center; min-height:44px; color:inherit; font-weight:600; line-height:1.45; text-decoration:none; overflow-wrap:anywhere; }
.headline-title:hover { text-decoration:underline; text-underline-offset:3px; }
.headline-title:focus-visible { outline:2px solid #31858f; outline-offset:3px; border-radius:4px; }
.headline-title:active { opacity:.75; }
.headline-source, .headlines-updated { margin:2px 0 4px; font-size:12px; line-height:1.4; color:inherit; }
.headlines-empty { line-height:1.5; }
.headlines-more { min-height:44px; margin-top:10px; }
.headlines-inline h3 { margin:8px 0; font-size:15px; }
.headlines-inline .bubble { max-width:720px; }
.news-settings { display:grid; gap:8px; }
.news-settings label { margin-top:8px; }
.news-settings input[type=range] { width:100%; min-height:44px; padding:0; accent-color:#064b55; }
.news-settings output { font-size:18px; font-weight:650; }
.news-toggle { display:flex; align-items:center; gap:8px; min-height:44px; }
.news-toggle input { width:20px; height:20px; margin:0; }
.news-times { display:grid; grid-template-columns:auto minmax(0,1fr) auto minmax(0,1fr); gap:8px; align-items:center; }
.news-times input { min-width:0; width:100%; }
.news-diagnostics { font-size:12px; line-height:1.5; padding-block:10px; overflow-wrap:anywhere; }
.news-diagnostics p { margin:5px 0; }
@media(max-width:360px) {
  .news-times { grid-template-columns:auto minmax(0,1fr); }
}

/* Approved compact navigation: one line per conversation, no message previews. */
#circle-list { container-type: inline-size; padding: 18px 10px 12px; }
#workspace-navigation .topbar { margin-bottom: 16px; }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 0 4px 8px; }
.list-heading h2 { white-space: nowrap; font-size: 10px; letter-spacing: 1px; }
#new-circle { display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: auto; min-height: 44px; margin: 0; padding: 4px 8px; border: 0; background: transparent; color: var(--accent); border-radius: 10px; font-size: 11px; white-space: nowrap; }
#new-circle:hover { background: #19191d; }
.circle-search { margin-bottom: 10px; }
.circle-row { display: grid; grid-template-columns: 36px minmax(0,1fr) auto; grid-template-rows: auto; align-items: center; column-gap: 9px; min-height: 56px; padding: 8px; margin: 2px 0; border-radius: 12px; text-align: left; }
.circle-row.selected::after { display: none; }
.circle-row .circle-avatar { grid-area: 1 / 1; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: #19191d; }
.circle-row.selected .circle-avatar { background: #0c0c10; }
.circle-row .row-top { grid-area: 1 / 2; display: flex; align-items: center; gap: 4px; min-width: 0; }
.circle-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.circle-row strong, .circle-heading, .circle-summary > div, .member-identity { min-width: 0; }
.circle-summary strong, .member-name, .sender-name, #workspace-welcome-title,
.dialog-header h2 { overflow-wrap: anywhere; max-width: 100%; }
.member-name, .sender-name { white-space: normal; }
.system-event, #direct-recipient, #typing-indicator, #reply-context { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.name-guidance { font-size: 12px; line-height: 1.4; margin: 6px 0 10px; overflow-wrap: anywhere; }
.name-guidance.name-error { color: var(--ink); font-weight: 600; }
.circle-row .row-meta { grid-area: 1 / 3; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.circle-row .row-time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.circle-row .unread { display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--teal); color: #fff; font-size: 10px; }
.circle-row.selected .unread { background: #0c0c10; }
.draft-indicator { color: var(--accent); font-size: 16px; }
.group-icon { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Vristy Emoji", sans-serif; font-size: 22px; }
.group-icon svg { width: 23px; height: 23px; fill: none; stroke: #8ac3ca; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#direct-section { padding-top: 14px; margin-top: 14px; }
#direct-section h2 { margin: 0 6px 10px; }
.list-options { margin: 10px 4px 0; border-top: 1px solid #222026; padding-top: 6px; }
.list-options button { color: var(--muted); min-height: 44px; }
.circle-icon-editor { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.circle-icon-editor .circle-avatar { display: grid; place-items: center; width: 44px; height: 44px; }
.circle-icon-editor button { min-height: 44px; }
.circle-icon-picker emoji-picker { width: 100%; max-width: 100%; --num-columns: 8; }
@container (max-width: 280px) {
  .create-label, .circle-row .row-time { display: none; }
  #new-circle { min-width: 44px; }
}
#workspace-welcome { position: relative; isolation: isolate; grid-column: 3; display: grid; place-items: center; min-width: 0; min-height: 0; overflow: auto; background: #f6f8f7; color: #10222c; border-radius: 18px; padding: 32px 24px; text-align: center; }
#workspace-welcome::before, #workspace-welcome::after { content: ""; position: absolute; z-index: -1; pointer-events: none; border-radius: 50%; background: #e8f2f0; }
#workspace-welcome::before { width: 70%; height: 75%; top: -40%; right: -30%; transform: rotate(-25deg); }
#workspace-welcome::after { width: 90%; height: 55%; bottom: -30%; left: -35%; transform: rotate(20deg); }
.workspace-welcome-content { width: min(100%, 680px); }
.workspace-welcome-art { width: min(300px, 55%); height: auto; margin-bottom: 22px; }
#workspace-welcome h1 { font-size: clamp(24px, 2.7vw, 36px); line-height: 1.2; letter-spacing: -.7px; margin: 0 0 14px; overflow-wrap: anywhere; }
#workspace-welcome-description { font-size: 15px; line-height: 1.6; color: #435b65; margin: 0 auto; max-width: 48ch; }
.welcome-features { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 20px; margin: 40px auto 0; max-width: 580px; }
.welcome-features span { display: grid; place-items: center; margin: 0 auto; width: 64px; height: 64px; border-radius: 50%; background: #e5efed; color: #086371; font-size: 31px; }
.welcome-features p { font-size: 13px; line-height: 1.5; margin: 10px 0 0; }
.welcome-features small { font-size: 11px; color: #435b65; }
#workspace-welcome[data-returning] .workspace-welcome-content { width: min(100%,940px); }
#workspace-welcome[data-returning] .workspace-welcome-art { width: min(210px,35%); margin-bottom: 14px; }
.home-stats-period { display: inline-block; border: 1px solid #badfdf; border-radius: 24px; padding: 9px 20px; color: #596d76; font-size: 13px; margin: 24px 0; }
.home-stat-cards { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.home-stat { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; border: 1px solid #dbe4e5; border-radius: 12px; background: #fff; padding: 23px 9px; }
.home-stat-icon { color: #086371; width: 32px; height: 32px; font-size: 29px; line-height: 32px; }
.home-stat strong { font-size: clamp(28px,3.3vw,48px); line-height: 1.2; font-variant-numeric: tabular-nums; color: #075b65; }
.home-stat > span:not(.home-stat-icon) { font-size: 14px; line-height: 1.4; min-height: 40px; display: grid; place-content: center; }
.home-stat small { font-size: 11px; line-height: 1.5; color: #687982; margin-top: auto; }
.home-stats-continue { margin: 28px 0 0; font-size: 13px; color: #687982; }
@media (max-width: 899px) {
  #circle-list { padding-top: max(12px,env(safe-area-inset-top)); }
  #workspace-welcome { display: block; padding: 14px 10px; margin: 0 0 14px; border-radius: 14px; overflow: hidden; }
  .workspace-welcome-art { width: 96px; margin-bottom: 6px; }
  #workspace-welcome h1 { font-size: 21px; margin-bottom: 8px; }
  #workspace-welcome-description { font-size: 12px; }
  .welcome-features { display: none; }
  #workspace-welcome[data-returning] .workspace-welcome-art { width: 72px; margin-bottom: 6px; }
  .home-stats-period { font-size: 11px; padding: 6px 10px; margin: 12px 0; }
  .home-stat-cards { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .home-stat { padding: 12px 6px; gap: 5px; }
  .home-stat-icon { width: 23px; height: 23px; line-height: 23px; font-size: 23px; }
  .home-stat strong { font-size: 30px; }
  .home-stat > span:not(.home-stat-icon) { font-size: 12px; min-height: 34px; }
  .home-stat small { font-size: 10px; }
  .home-stats-continue { font-size: 11px; margin: 14px 0 0; }
  .circle-row { min-height: 56px; }
  .circle-icon-picker emoji-picker { --num-columns: 7; }
}

/* Pending activity counts stay attached to icons, separate from rail labels. */
#app-navigation button { position: relative; }
#app-navigation .nav-count { position: absolute; top: 2px; right: 2px; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 10px; background: #087c8a; color: #fff; box-shadow: 0 0 0 2px #0c0c10; font-size: 10px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
#app-navigation .nav-count[hidden] { display: none; }
#dialog[data-activity] .activity-actions { margin-bottom: 8px; }
#dialog[data-activity] .activity-intro { margin: 0 0 12px; font-size: 12px; }
#dialog[data-activity] .activity-item { display: grid; grid-template-columns: minmax(0,1fr) 44px; align-items: start; gap: 2px; margin: 0 0 8px; padding: 4px; background: #19191d; border: 1px solid #303036; border-radius: 14px; }
#dialog[data-activity] .activity-open { display: grid; gap: 4px; width: 100%; min-width: 0; padding: 10px 12px; margin: 0; border: 0; border-radius: 10px; background: transparent; text-align: left; }
#dialog[data-activity] .activity-open:hover, #dialog[data-activity] .activity-open:focus-visible { background: #232329; }
.activity-meta { color: #aaa7b1; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.activity-author { color: #ecebed; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.activity-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 3px; padding-left: 10px; border-left: 2px solid #38909a; color: #d0ced5; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; white-space: normal; }
#dialog[data-activity] .activity-dismiss { width: 44px; min-height: 44px; margin: 0; padding: 0; border: 0; background: transparent; color: #aaa7b1; font-size: 21px; }
#dialog[data-activity] .activity-dismiss:hover { color: #fff; background: #303036; }

/* Stable content-free geometry for a genuinely missing/reauthorizing viewport. */
.conversation-placeholder { padding: 24px 0; display: grid; gap: 22px; }
.conversation-placeholder span { display: block; height: 34px; width: min(65%, 380px); border-radius: 6px; background: color-mix(in srgb, currentColor 5%, transparent); }
.conversation-placeholder span:nth-child(2) { width: min(45%, 260px); }

/* In-workspace destination pages; the existing form surface is nonmodal here. */
#workspace-page { grid-area: 1 / 3; min-width: 0; min-height: 0; height: 100%; overflow: hidden; border-radius: 18px; background: #101017; }
#workspace[data-page-open] #conversation, #workspace[data-page-open] #workspace-welcome { display: none !important; }
#workspace-page #dialog[open] { position: static; inset: auto; transform: none; display: flex; flex-direction: column; width: 100%; max-width: none; height: 100%; max-height: none; min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
#workspace-page #dialog .dialog-header { flex: 0 0 auto; display: grid; grid-template-columns: 44px minmax(0,1fr); align-items: center; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
#workspace-page #dialog .dialog-header h2 { grid-area: 1 / 2; margin: 0; font-size: 24px; }
#workspace-page #close-dialog { grid-area: 1 / 1; width: 44px; min-height: 44px; padding: 0; margin: 0; }
#workspace-page #dialog #dialog-content { flex: 1; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 24px; scroll-padding: 24px; }
#workspace-page #dialog #dialog-error { flex: 0 0 auto; }
#workspace-page .direct-page-list { max-width: 900px; }
#workspace-page .circle-row { width: 100%; margin-block: 8px; background: #19191d; }
#workspace-page .circle-row.selected { background: var(--teal); }
#app-navigation button[data-current] { color: white; background: var(--teal); }
#app-navigation #nav-home:not([data-current]) { background: transparent; color: var(--muted); }
#conversation #circle-info { position: static; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; align-self: start; }
#conversation #circle-info > svg { position: static; display: block; width: 21px; height: 21px; margin: auto; }
#circle-info > .control-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (min-width:900px) {
  #conversation .conversation-header { grid-template-columns: minmax(0,1fr) 44px 44px; }
  #conversation #search-messages { grid-area: 1 / 2 / 3 / 3; }
  #conversation #circle-info { grid-area: 1 / 3 / 3 / 4; }
}
@media (max-width:899px) {
  #workspace-page { grid-area: 1 / 2; border-radius: 0; }
  #workspace[data-page-open] #circle-list { display: none !important; }
  #workspace-page #dialog .dialog-header { padding: max(10px,env(safe-area-inset-top)) 10px 10px; gap: 6px; }
  #workspace-page #dialog .dialog-header h2 { font-size: 20px; }
  #workspace-page #dialog #dialog-content { padding: 16px 10px max(16px,env(safe-area-inset-bottom)); }
  #conversation .conversation-header { grid-template-columns: 44px minmax(0,1fr) 44px 44px; }
  #conversation .conversation-header .circle-heading { display: block; position: static; grid-area: 1 / 2; min-width: 0; }
  .circle-heading .mobile-circle-identity { display: grid; grid-template-columns: 32px minmax(0,1fr); gap: 2px 8px; align-items: center; text-align: left; }
  #conversation #search-messages { grid-area: 1 / 3; }
  #conversation #circle-info { grid-area: 1 / 4; }
  #circle-header-meta { padding: 0; }
  #conversation #mode-bar { grid-area: 2 / 2 / 3 / -1; }
}
#workspace-page .circle-row.selected .row-time { color: #ecebed; }

/* Keep the disclosure's responsive space while authorization/retention catches
   up. Visibility also keeps hidden copy out of the accessibility tree. */
#retention-notice { flex-shrink: 0; }
#retention-notice[hidden] { display: block !important; visibility: hidden; }

/* Presence never occupies flow space or changes message/avatar dimensions. */
[data-presence-user] { position: relative; }
[data-presence-user][data-online="true"]::after {
  content: ""; position: absolute; right: -1px; bottom: -1px;
  width: 6px; height: 6px; border: 1.5px solid #f4f4f4;
  border-radius: 50%; background: #168b49; pointer-events: none;
}
.link-previews { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 6px; width: 100%; max-width: 100%; min-width: 0; }
#conversation .message:has(.link-previews) { width: 100%; max-width: 100%; }
#conversation .bubble:has(.link-previews) { width: 100%; min-width: 0; }
#conversation .link-preview { position: relative; width: 420px; max-width: 100%; height: 132px; box-sizing: border-box; overflow: hidden; border: 1px solid #d9dfe0; border-radius: 12px; background: #f8faf9; color: #172c33; }
#conversation .link-preview.link-video { height: 250px; }
#conversation .link-preview.link-social { height: 360px; }
#conversation .link-preview-source { display: block; box-sizing: border-box; height: 36px; padding: 9px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #075f6b; font-size: 11px; text-decoration: none; }
#conversation .link-preview-main { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 7px; width: 100%; height: calc(100% - 36px); min-height: 0; margin: 0; padding: 12px 40px 12px 12px; border: 0; border-radius: 0; background: transparent; color: inherit; text-align: left; overflow: hidden; }
#conversation .link-preview-main strong { position: relative; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 100%; font-size: 14px; line-height: 1.35; }
#conversation .link-preview-description { position: relative; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 100%; font-size: 12px; line-height: 1.5; }
#conversation .link-social .link-preview-description { -webkit-line-clamp: 8; }
#conversation .link-preview-main img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#conversation .link-article .link-preview-main { padding-left: 124px; }
#conversation .link-article .link-preview-main img { width: 112px; }
#conversation .link-social .link-preview-main { justify-content: flex-start; padding-bottom: 112px; }
#conversation .link-social .link-preview-main img { top: auto; bottom: 0; height: 104px; }
#conversation .link-video .link-preview-main strong { position: absolute; top: 8px; left: 8px; right: 8px; background: #fffffff2; padding: 5px 8px; border-radius: 5px; max-width: calc(100% - 16px); }
#conversation .link-video .link-preview-description { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); padding: 2px 8px; border-radius: 5px; background: #fffffff2; -webkit-line-clamp: 1; }
#conversation .link-preview-symbol { position: absolute; right: 12px; bottom: 12px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #064b55; color: white; font-size: 18px; }
#conversation .link-video .link-preview-symbol { right: calc(50% - 24px); bottom: calc(50% - 24px); width: 48px; height: 48px; }
#conversation .link-preview iframe { position: absolute; inset: 36px 0 0; width: 100%; height: calc(100% - 36px); border: 0; background: white; }
#conversation .link-close { position: absolute; right: 0; top: 0; width: 36px; height: 36px; min-height: 36px; padding: 0; border: 0; background: #f8faf9; color: #172c33; font-size: 23px; }
@media (pointer: coarse) { #conversation .link-preview-source { height: 44px; padding-block: 13px; } #conversation .link-preview-main, #conversation .link-preview iframe { height: calc(100% - 44px); } #conversation .link-preview iframe { top: 44px; } #conversation .link-close { width: 44px; height: 44px; min-height: 44px; } }
