/* ai-collab. Design rules live in SPEC.md section 9. */

:root {
  --c-teal: #0CA678;
  --c-violet: #7048E8;
  --c-orange: #F76707;
  --c-pink: #D6336C;
  --c-blue: #1C7ED6;
  --c-lime: #5C940D;
  --bg: #F7F7F5;
  --surface: #FFFFFF;
  --surface-2: #F1F1EE;
  --border: #E6E5E1;
  --text: #1C1C1A;
  --text-2: #5F5E5A;
  --text-3: #8D8C87;
  --accent: #3B5BDB;
  --accent-ink: #FFFFFF;
  --accent-soft: #EDF1FD;
  --accent-line: #C9D3F6;
  --danger: #C92A2A;
  --scrim: rgba(20, 20, 18, 0.42);
  --shadow-sm: 0 1px 2px rgba(20, 20, 18, 0.05);
  --shadow: 0 1px 2px rgba(20, 20, 18, 0.04), 0 4px 16px rgba(20, 20, 18, 0.06);
  --shadow-lg: 0 8px 32px rgba(20, 20, 18, 0.16);
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --fast: 160ms;
  --slow: 200ms;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-teal: #38D9A9;
    --c-violet: #9775FA;
    --c-orange: #FFA94D;
    --c-pink: #F06595;
    --c-blue: #4DABF7;
    --c-lime: #94D82D;
    --bg: #141413;
    --surface: #1D1D1B;
    --surface-2: #262624;
    --border: #33332F;
    --text: #EDEDEA;
    --text-2: #A9A8A2;
    --text-3: #7A7974;
    --accent: #8EA2F5;
    --accent-ink: #10142B;
    --accent-soft: #1F2540;
    --accent-line: #34407A;
    --danger: #FF8787;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow-sm: none;
    --shadow: 0 0 0 1px var(--border);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
svg.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */

.shell { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-t) + 12px) 20px 12px;
  background: var(--bg);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.topbar .project { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.topbar .eyebrow { font-size: 12px; font-weight: 500; color: var(--text-3); letter-spacing: 0.01em; }
.topbar h1 { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s var(--ease) infinite; }

main.view {
  flex: 1;
  padding: 8px 20px calc(var(--nav-h) + var(--safe-b) + 28px);
  animation: view-in var(--slow) var(--ease);
}
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

.section-title { font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin: 24px 4px 10px; }
.section-title:first-child { margin-top: 8px; }

/* ---------- Bottom nav ---------- */

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--border);
}
.nav-inner { display: grid; grid-template-columns: repeat(var(--tabs, 4), 1fr); width: 100%; max-width: 560px; }
.nav button {
  position: relative;
  height: var(--nav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--text-3);
  font-size: 11.5px; font-weight: 500;
  transition: color var(--fast) var(--ease);
}
.nav button svg.icon { transition: transform var(--fast) var(--ease); }
.nav button:active svg.icon { transform: scale(0.9); }
.nav button[aria-current="page"] { color: var(--accent); }
.nav button[aria-current="page"] svg.icon { stroke-width: 2.1; }
.badge {
  position: absolute; top: 8px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
  animation: pop 260ms var(--ease);
}
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600; font-size: 16px; text-decoration: none;
  transition: transform var(--fast) var(--ease), background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), opacity var(--fast) var(--ease);
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn.ghost { background: none; color: var(--text-2); }
.btn.danger { background: none; color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.btn svg.icon { width: 20px; height: 20px; }
.link-btn { border: 0; background: none; color: var(--text-2); font-weight: 500; padding: 12px; min-height: 48px; }

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

/* ---------- Cards and lists ---------- */

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 16px; }
.row + .row { border-top: 1px solid var(--border); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 500; }
.row .sub { font-size: 14px; color: var(--text-2); }
.row .sub.mono { font-family: var(--mono); font-size: 12.5px; }

.avatar {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600; font-size: 15px;
  background: var(--surface-2); color: var(--text-2);
}
.avatar.me { background: var(--accent-soft); color: var(--accent); }
button.avatar { border: 0; padding: 0; }
.avatar.agent { border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.avatar.agent svg.icon { width: 20px; height: 20px; }
.avatar.lg { width: 44px; height: 44px; font-size: 17px; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); margin-right: 6px; vertical-align: 1px; }
.status-dot.on { background: var(--accent); }

/* ---------- Empty states ---------- */

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 48px 12px 24px;
}
.empty .art {
  width: 72px; height: 72px; border-radius: 22px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  margin-bottom: 20px;
}
.empty .art svg.icon { width: 32px; height: 32px; stroke-width: 1.6; }
.empty h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 8px; }
.empty p { color: var(--text-2); max-width: 320px; margin-bottom: 24px; }
.empty .btn { min-width: 220px; }

/* ---------- Activity ---------- */

.feed { display: flex; flex-direction: column; gap: 2px; }
.event { display: flex; gap: 12px; padding: 12px 4px; align-items: flex-start; }
.event + .event { border-top: 1px solid var(--border); }
.event .avatar { margin-top: 1px; }
.event .line { color: var(--text); }
.event .line b { font-weight: 600; }
.event .meta { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.event .post-body { margin-top: 8px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--border); color: var(--text); font-size: 15px; }
.event.enter { animation: slide-in 320ms var(--ease); }
.event.live .meta::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 1px; animation: pulse 1.6s var(--ease) infinite; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-10px); } }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- Question card ---------- */

.qcard { padding: 18px 16px 8px; animation: view-in var(--slow) var(--ease); }
.qcard + .qcard { margin-top: 12px; }
.q-who { display: flex; align-items: center; gap: 12px; }
.q-who .name { font-weight: 600; }
.q-who .where { font-size: 13.5px; color: var(--text-3); }
.q-working {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 0 0; padding: 8px 12px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2); font-size: 14px;
}
.q-working svg.icon { width: 16px; height: 16px; color: var(--text-3); }
.q-text { font-size: 20px; line-height: 1.4; font-weight: 600; letter-spacing: -0.01em; margin: 16px 0 6px; }
.q-context summary { list-style: none; cursor: pointer; color: var(--accent); font-weight: 500; font-size: 15px; padding: 8px 0; min-height: 40px; display: flex; align-items: center; gap: 6px; }
.q-context summary::-webkit-details-marker { display: none; }
.q-context summary svg.icon { width: 16px; height: 16px; transition: transform var(--fast) var(--ease); }
.q-context[open] summary svg.icon { transform: rotate(90deg); }
.q-context .body { color: var(--text-2); font-size: 15px; padding: 2px 0 8px; }
.q-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 0 16px; border-radius: 12px; text-align: left;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 500;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.choice:active { transform: scale(0.98); }
.choice:hover { border-color: var(--accent-line); }
.choice .key { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 600; flex: none; }
.choice.own { color: var(--text-2); border-style: dashed; }
.choice.picked { border-color: var(--accent); background: var(--accent-soft); }
.compose { display: none; flex-direction: column; gap: 10px; }
.compose.open { display: flex; animation: view-in var(--slow) var(--ease); }
textarea, input.text {
  width: 100%; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface);
  padding: 12px 14px; font-size: 16px; line-height: 1.45; resize: none;
  transition: border-color var(--fast) var(--ease);
}
textarea:focus, input.text:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 96px; }
.q-footer { display: flex; justify-content: center; }

.qcard.sent { padding-bottom: 18px; }
.sent-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 8px 6px; animation: view-in var(--slow) var(--ease); }
.sent-state .check { width: 64px; height: 64px; margin-bottom: 14px; }
.sent-state .check circle { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 190; stroke-dashoffset: 190; animation: draw 420ms var(--ease) forwards; }
.sent-state .check path { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 260ms 300ms var(--ease) forwards; }
.sent-state h3 { font-size: 18px; font-weight: 650; }
.sent-state p { color: var(--text-2); margin-top: 4px; font-size: 15px; }
.sent-state .answer { margin-top: 12px; padding: 8px 14px; border-radius: 10px; background: var(--surface-2); font-weight: 500; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.qcard.sent .sent-state { animation: confirm 420ms var(--ease); }
@keyframes confirm { 0% { transform: scale(0.96); opacity: 0; } 60% { transform: scale(1.015); opacity: 1; } 100% { transform: scale(1); } }

/* ---------- Toast (simulated notification) ---------- */

.toast {
  position: fixed; left: 12px; right: 12px; top: calc(var(--safe-t) + 10px); z-index: 75;
  max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  border: 0; text-align: left; width: auto;
  transform: translateY(calc(-100% - 40px)); transition: transform 360ms var(--ease);
}
.toast.show { transform: none; }
.toast .t1 { font-weight: 600; font-size: 15px; }
.toast .t2 { font-size: 14px; color: var(--text-2); }

/* ---------- Sheet ---------- */

.sheet-scrim { position: fixed; inset: 0; z-index: 80; background: var(--scrim); opacity: 0; transition: opacity var(--slow) var(--ease); }
.sheet-scrim.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81;
  max-width: 560px; margin: 0 auto;
  background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(var(--safe-b) + 20px);
  transform: translateY(100%); transition: transform 240ms var(--ease);
  box-shadow: var(--shadow-lg);
}
.sheet.show { transform: none; }
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 16px; }
.sheet h2 { font-size: 20px; font-weight: 650; margin-bottom: 6px; }
.sheet p { color: var(--text-2); margin-bottom: 18px; }
.sheet .actions { display: flex; flex-direction: column; gap: 8px; }

.copybox {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
  background: var(--surface-2); border-radius: 10px; padding: 12px;
  max-height: 140px; overflow: auto; white-space: pre-wrap; word-break: break-all;
  user-select: all; -webkit-user-select: all; margin-bottom: 12px;
}

/* ---------- Auth screens ---------- */

.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; max-width: 440px; margin: 0 auto; padding: calc(var(--safe-t) + 32px) 24px calc(var(--safe-b) + 32px); animation: view-in var(--slow) var(--ease); }
.auth .logo { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 24px; box-shadow: var(--shadow); }
.auth h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 10px; }
.auth .lead { color: var(--text-2); font-size: 17px; margin-bottom: 28px; }
.auth form { display: flex; flex-direction: column; gap: 12px; }
.auth .paste-row { display: flex; gap: 8px; }
.auth .paste-row input { flex: 1; }
.auth .error { color: var(--danger); font-size: 15px; min-height: 22px; }
.auth .alt { margin-top: 20px; text-align: center; }
.steps { list-style: none; padding: 0; margin: 0 0 28px; display: flex; flex-direction: column; gap: 12px; counter-reset: step; }
.steps li { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.steps li .n { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.steps li .i { display: inline-flex; vertical-align: -5px; color: var(--accent); }
.steps li .i svg.icon { width: 20px; height: 20px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tour (after Plinth's tutorial) ---------- */

.tour { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.tour-block { position: fixed; pointer-events: auto; background: transparent; }
.tour-spot {
  position: fixed; border-radius: 16px; pointer-events: none;
  box-shadow: 0 0 0 9999px var(--scrim), 0 0 0 2px var(--accent);
  transition: all 260ms var(--ease);
}
.tour-spot.none { box-shadow: 0 0 0 9999px var(--scrim); width: 0 !important; height: 0 !important; left: 50% !important; top: 50% !important; }
.tour-card {
  position: fixed; left: 16px; top: 0;
  width: min(380px, calc(100vw - 32px));
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 18px 18px 14px; pointer-events: auto;
  transition: transform 260ms var(--ease), opacity var(--slow) var(--ease);
}
.tour-card.hidden { opacity: 0; }
.tour-step { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.tour-card h2 { margin: 4px 0 6px; font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.tour-card p { color: var(--text-2); font-size: 15.5px; }
.tour-card .hint { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; font-weight: 500; color: var(--accent); }
.tour-card .hint::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.2s var(--ease) infinite; }
.tour-actions { display: flex; align-items: center; gap: 4px; margin-top: 14px; }
.tour-dots { display: flex; gap: 6px; flex: 1; }
.tour-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: background-color var(--fast) var(--ease), width var(--fast) var(--ease); }
.tour-dots span.done { background: var(--accent-line); }
.tour-dots span.on { background: var(--accent); width: 18px; border-radius: 4px; }
.tour-actions .btn { min-height: 44px; padding: 0 14px; font-size: 15px; }
.tour-card.center { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(400px, calc(100vw - 32px)); padding: 24px 22px 16px; }
.tour-card.center h2 { font-size: 22px; }
.tour-card .welcome-art { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 14px; }
.tour-card.dock { padding: 12px 16px 14px; }
body.tour-dock main.view { padding-bottom: 260px; }
.tour-card.dock h2 { font-size: 17px; margin: 2px 0 2px; }
.tour-card.dock p { font-size: 14.5px; }
.dock-head { display: flex; align-items: center; justify-content: space-between; }
.link-skip { border: 0; background: none; color: var(--text-2); font-weight: 500; font-size: 14px; padding: 8px 0 8px 12px; min-height: 36px; }
.tour-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.tour-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.tour-row .grow { flex: 1; min-width: 0; }
.tour-row .title { font-weight: 600; font-size: 15.5px; }
.tour-row .sub { font-size: 13.5px; color: var(--text-2); }
.tour-row .avatar { background: var(--surface); }

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

/* ---------- Member colors (identity only, SPEC.md 4.1) ---------- */

.avatar.member { background: color-mix(in srgb, var(--m) 16%, var(--surface)); color: var(--m); }
.avatar.member.agent { background: color-mix(in srgb, var(--m) 14%, var(--surface)); }
.dot-m { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--m); flex: none; }

/* ---------- Lanes ---------- */

.lanes { display: flex; flex-direction: column; gap: 12px; }
.lane {
  position: relative; overflow: hidden;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px 6px;
  transition: box-shadow var(--slow) var(--ease);
}
.lane.ping { animation: lane-ping 800ms var(--ease); }
@keyframes lane-ping { 25% { background: color-mix(in srgb, var(--m) 8%, var(--surface)); } }
.lane.blocked { animation: breathe 2s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--m) 55%, transparent), 0 0 10px 0 color-mix(in srgb, var(--m) 25%, transparent); }
  50% { box-shadow: 0 0 0 2px var(--m), 0 0 28px 4px color-mix(in srgb, var(--m) 45%, transparent); }
}
.lane-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.lane-name { font-weight: 650; font-size: 16px; }
.lane-name .you { font-weight: 500; color: var(--text-3); }
.needed {
  margin-left: auto; height: 26px; padding: 0 10px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--m) 16%, var(--surface)); color: var(--m);
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.01em;
}
.lane-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; min-height: 52px; width: 100%;
  border: 0; background: none; text-align: left;
}
.lane-row + .lane-row { border-top: 1px solid var(--border); }
.lane-row.mine { cursor: pointer; border-radius: 10px; transition: background-color var(--fast) var(--ease); }
.lane-row.mine:active { background: var(--surface-2); }
.row-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); margin-top: 1px; }
.row-icon svg.icon { width: 17px; height: 17px; }
.row-icon.agent { background: color-mix(in srgb, var(--m) 14%, var(--surface)); color: var(--m); }
.row-who { font-size: 12.5px; font-weight: 600; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.row-who .state { display: inline-flex; align-items: center; gap: 5px; }
.row-who .state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.row-who .state.working::before { background: var(--m); animation: pulse 1.6s var(--ease) infinite; }
.row-who .state.blocked { color: var(--m); }
.row-who .state.blocked::before { background: var(--m); }
.row-who .state.focus::before { background: var(--text-3); }
.row-plain { font-size: 16px; color: var(--text); line-height: 1.4; margin-top: 1px; }
.lane-row.focus .row-plain, .lane-row.away .row-plain, .lane-row.stale .row-plain { color: var(--text-3); }
.row-wait { margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--m); }
.row-time { font-size: 12.5px; color: var(--text-3); white-space: nowrap; margin-top: 2px; }
.row-edit { color: var(--text-3); margin-top: 6px; }
.row-edit svg.icon { width: 18px; height: 18px; }
.lane-row.cta { color: var(--accent); font-weight: 600; align-items: center; }
.lane-row.cta .row-icon { background: var(--accent-soft); color: var(--accent); }
.lane-row.none .row-plain { color: var(--text-3); font-size: 15px; }
details.more { margin-top: 6px; }
details.more summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-3); min-height: 28px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary svg.icon { width: 14px; height: 14px; transition: transform var(--fast) var(--ease); }
details.more[open] summary svg.icon { transform: rotate(90deg); }
details.more .detail { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; margin-top: 4px; }

/* Feed pulse: new items wash in with the actor's color. */
.event { position: relative; border-radius: 12px; }
.event.pulse { animation: slide-in 320ms var(--ease); }
.event.pulse { animation: slide-in 320ms var(--ease), wash 1100ms var(--ease); }
@keyframes wash { 0%, 30% { background: color-mix(in srgb, var(--m) 10%, transparent); } 100% { background: transparent; } }
.event .line b { color: var(--text); }
.event .post-link { display: inline-block; margin-top: 6px; font-size: 14px; font-weight: 600; text-decoration: none; }
.feed-empty { color: var(--text-3); font-size: 15px; padding: 8px 4px 0; }

/* ---------- Status sheet ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 500; font-size: 15px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip .dot-m { width: 10px; height: 10px; }
.field-label { display: block; font-size: 14px; font-weight: 600; color: var(--text-2); margin: 16px 0 8px; }
.sheet .stack { display: flex; flex-direction: column; }
.sheet .hint-text { font-size: 14px; color: var(--text-3); margin-top: 8px; }
.sheet { max-height: 92dvh; overflow-y: auto; }
.sheet .actions { margin-top: 20px; }

/* ---------- Decisions ---------- */

.day { font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin: 20px 4px 8px; }
.day:first-child { margin-top: 8px; }
.decision { display: flex; gap: 12px; padding: 14px 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.decision + .decision { margin-top: 10px; }
.decision.enter { animation: slide-in 320ms var(--ease); }
.decision .d-title { font-weight: 650; font-size: 16.5px; line-height: 1.35; }
.decision .d-reason { color: var(--text-2); margin-top: 4px; font-size: 15px; }
.decision .d-meta { font-size: 13px; color: var(--text-3); margin-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- Add why ---------- */

.why { display: flex; gap: 8px; margin-top: 14px; width: 100%; }
.why input { flex: 1; min-width: 0; }
.why-saved { margin-top: 12px; color: var(--text-2); font-size: 15px; }

/* Raise the nav above the tour scrim when a step asks you to tap it. */
body.tour-nav-up .nav { z-index: 72; }

/* ---------- Questions, step 3 ---------- */

.urgent-pill { margin-left: auto; align-self: flex-start; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; }
.q-footer { gap: 8px; }
.card.asked { padding: 14px 16px; position: relative; overflow: hidden; }
.card.asked + .card.asked { margin-top: 10px; }
.asked-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.asked-q { font-weight: 600; font-size: 16px; margin-top: 6px; line-height: 1.4; }
.asked-a { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 600; display: inline-block; }
.asked-why { margin-top: 6px; color: var(--text-2); font-size: 15px; }
.asked-actions { margin-top: 4px; }
.asked-actions .link-btn { padding-left: 0; }
.option-row { display: flex; gap: 8px; margin-bottom: 8px; }
.option-row input { flex: 1; min-width: 0; }
.toggles { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.toggle input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.toggle small { color: var(--text-2); font-size: 13.5px; }
select.text { appearance: none; -webkit-appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238D8C87' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 18px; padding-right: 40px; width: 100%; }
.lane-ask { margin-left: auto; min-height: 36px; padding: 0 12px; color: var(--accent); }
.row-answer { min-height: 32px; padding: 0 12px; margin-left: 8px; font-size: 14px; vertical-align: middle; }
.row-wait { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }

/* ---------- Decisions, step 3 ---------- */

.chips.filters { margin: 14px 0 4px; }
.chips.filters .chip { min-height: 36px; font-size: 14px; }
.decision .d-question { font-size: 13.5px; color: var(--text-3); margin-bottom: 4px; line-height: 1.35; }
.decision.replaced .d-title { text-decoration: line-through; color: var(--text-3); }
.decision .d-replaced { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--text-2); }

/* ---------- Alerts, step 4 ---------- */

.card.nudge { padding: 14px 16px; margin-bottom: 12px; border: 1px solid var(--accent-line); }
.nudge-row { display: flex; gap: 12px; align-items: center; }
.nudge-row .title { font-weight: 650; }
.nudge-row .sub { font-size: 14px; color: var(--text-2); }
.nudge-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-left: 48px; }
.qcard.flash { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--accent), var(--shadow); } 100% { box-shadow: var(--shadow); } }

/* ---------- Proof and explain, step 5 ---------- */

.top-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.top-actions .btn { padding: 0 12px; font-size: 15px; }
.card.ship { padding: 18px 16px 14px; position: relative; overflow: hidden; }
.card.ship + .card.ship { margin-top: 12px; }
.should { margin: 10px 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); }
.should-label { font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.should p { font-size: 17px; line-height: 1.45; color: var(--text); margin-top: 4px; }
.preview-btn { min-height: 52px; }
.verdict { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.verdict .btn { min-height: 52px; white-space: nowrap; padding: 0 10px; }
.verdict .btn[data-yes]:hover, .verdict .btn[data-yes]:active { border-color: var(--accent); }
.verdict .btn.picked { border-color: var(--accent); background: var(--accent-soft); }
.card.ship .compose { margin-top: 12px; }
.explain-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px;
  min-height: 32px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 600; flex: none;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.explain-btn:hover { border-color: var(--accent-line); color: var(--accent); }
.explain-btn svg.icon { width: 14px; height: 14px; }
.lane-row .explain-btn, .event .explain-btn, .decision .explain-btn { margin-left: 8px; min-height: 28px; padding: 0 8px; font-size: 12px; vertical-align: middle; }
.lane-row .explain-btn { margin: 6px 0 0; }
.explain-text { font-size: 17px; line-height: 1.55; color: var(--text); margin: 4px 0 18px; }
.check-it { margin-top: 8px; }
.card.ship.flash { animation: flash 1.6s var(--ease); }

/* ---------- Steering, step 6 ---------- */

.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.row-actions .explain-btn { margin: 0; }
.steer-btn {
  min-height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-size: 12px; font-weight: 600;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.steer-btn[data-steer="reset"]:hover { border-color: var(--danger); color: var(--danger); }
.steer-btn[data-steer="direction"]:hover { border-color: var(--accent-line); color: var(--accent); }
.btn.stop { background: var(--danger); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.stop { color: #1D1D1B; } }
.pinned { margin: 8px 0 8px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--m) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--m) 35%, transparent); }
.pinned-head { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
.pinned-head svg.icon { width: 16px; height: 16px; color: var(--m); }
.pinned p { margin: 6px 0 10px; color: var(--text); font-size: 15px; }
.pinned .pinned-rule { font-weight: 600; }
.pinned .hint-text { margin: 0; }
.lane-row.resetting .row-plain { color: var(--text-2); }

/* ---------- Person colors without side stripes ---------- */

.name-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--m) 11%, var(--surface));
  color: var(--text); font-weight: 650;
}
.name-chip .dot-m { width: 8px; height: 8px; }

/* ---------- Sign-in code ---------- */

.code-box { margin: 4px 0 2px; padding: 18px 12px; border-radius: 14px; background: var(--surface-2); text-align: center; }
.code-box .code { font-family: var(--mono); font-size: 34px; font-weight: 700; letter-spacing: 0.12em; color: var(--text); user-select: all; -webkit-user-select: all; }
.code-box .code-note { margin-top: 6px; font-size: 14px; color: var(--text-2); }
.code-input { font-family: var(--mono); font-size: 20px; letter-spacing: 0.1em; text-transform: uppercase; }

.auth .hint-text { color: var(--text-3); font-size: 15px; }

/* ---------- Team: invites and first sign-in ---------- */

.team-invites { margin-top: 12px; }
.avatar.xl { width: 64px; height: 64px; font-size: 26px; margin-bottom: 24px; }
.swatches { display: flex; gap: 14px; flex-wrap: wrap; }
.swatch {
  width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0;
  background: var(--m);
  transition: box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.swatch:active { transform: scale(0.94); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--m); }
.sheet .result .hint-text { margin: -4px 0 4px; }

/* ---------- Collaborations list ---------- */
/* Wide screens: a list beside the open collaboration, like Messages on a Mac.
   Phones: the list is its own screen, and the back arrow returns to it. */

:root { --side-w: 340px; }

.side {
  display: none;
  background: var(--surface);
  min-height: 100dvh;
  padding: calc(var(--safe-t) + 12px) 12px calc(var(--safe-b) + 24px);
}
.side-head { padding: 0 8px 12px; display: flex; flex-direction: column; gap: 14px; }
.side-head h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; padding-top: 6px; }
.side-head .btn svg.icon { width: 18px; height: 18px; stroke-width: 2.2; }

.convos { display: flex; flex-direction: column; gap: 2px; }
.convos .load-failed { margin: 8px; }
.convos-loading { display: flex; align-items: center; gap: 10px; padding: 18px 12px; color: var(--text-2); font-size: 15px; }

.convo {
  display: grid; grid-template-columns: 10px 48px 1fr; align-items: center; gap: 10px;
  width: 100%; padding: 10px 10px 10px 4px; border: 0; border-radius: 12px;
  background: none; text-align: left;
  transition: background-color var(--fast) var(--ease);
}
.convo:hover { background: var(--surface-2); }
.convo.active { background: var(--accent-soft); }
.convo + .convo:not(.active):not(:hover) .convo-main { box-shadow: 0 -1px 0 var(--border); }
.convo .unread-dot { width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.convo.unread .unread-dot { background: var(--accent); }

/* The team as color dots, in place of a photo. */
.convo-dots {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--surface-2);
  display: grid; place-content: center; gap: 4px;
  grid-template-columns: repeat(2, 14px);
}
.convo-dots.n1 { grid-template-columns: 18px; }
.convo-dots.n1 span { width: 18px; height: 18px; }
.convo-dots span { width: 14px; height: 14px; border-radius: 50%; background: var(--m); }
.convo-dots.n3 span:last-child { grid-column: span 2; justify-self: center; }

.convo-main { display: flex; flex-direction: column; min-width: 0; padding: 2px 0; }
.convo-top { display: flex; align-items: baseline; gap: 8px; }
.convo-name { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-time { flex: none; font-size: 13px; color: var(--text-3); }
.convo.unread .convo-time { color: var(--accent); font-weight: 600; }
.convo-team { display: flex; align-items: center; gap: 4px; margin-top: 1px; font-size: 13px; color: var(--text-3); min-width: 0; overflow: hidden; }
.convo-team .dot-m { width: 7px; height: 7px; flex: none; }
.convo-team span:last-child { margin-left: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-last {
  margin-top: 2px; font-size: 14.5px; line-height: 1.35; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.convo.unread .convo-last { color: var(--text); }

/* Back to the list (phones only). */
.topbar .back {
  position: relative; flex: none;
  width: 40px; height: 40px; margin-left: -10px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: none; color: var(--accent);
}
.topbar .back svg.icon { width: 26px; height: 26px; stroke-width: 2.2; }
.topbar .back:active { background: var(--surface-2); }
.back-unread { position: absolute; top: 7px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }

/* Narrower screens: one screen at a time. */
.layout.list-open .side { display: block; }
.layout.list-open .stage { display: none; }
.layout.list-open .side > * { max-width: 640px; margin-left: auto; margin-right: auto; }

@media (min-width: 1280px) {
  :root { --side-w: 320px; }
  .layout.with-list { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .layout.with-list .side {
    display: block; position: sticky; top: 0; height: 100dvh; overflow-y: auto;
    border-right: 1px solid var(--border);
  }
  .layout.with-list .topbar .back { display: none; }
  .convo .unread-dot { width: 9px; height: 9px; }
}

/* ---------- A list that couldn't load ---------- */

.load-failed { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.load-failed .title { font-weight: 600; }
.load-failed .sub { color: var(--text-2); font-size: 15px; margin-bottom: 6px; }
.load-failed .btn svg.icon { width: 18px; height: 18px; }

/* A connected agent that hasn't said what it's doing yet. */
.row-who .state.connected::before { background: var(--m); }
.lane-row.connected .row-plain { color: var(--text-2); }

/* ---------- Rename in place ---------- */

.topbar h1 { min-width: 0; }
.title-btn {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  margin: -2px -8px; padding: 2px 8px; border: 0; border-radius: 8px;
  background: none; font: inherit; color: inherit; letter-spacing: inherit; text-align: left; cursor: text;
  transition: background-color var(--fast) var(--ease);
}
.title-btn .title-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-btn .title-pencil { width: 16px; height: 16px; color: var(--text-3); opacity: 0.7; transition: opacity var(--fast) var(--ease); }
@media (hover: hover) {
  .title-btn .title-pencil { opacity: 0; }
  .title-btn:hover { background: var(--surface-2); }
  .title-btn:hover .title-pencil, .title-btn:focus-visible .title-pencil { opacity: 1; }
}
.title-input {
  width: 100%; margin: -2px -8px; padding: 2px 8px;
  border: 1px solid var(--accent); border-radius: 8px; outline: none;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 20px; font-weight: 650; letter-spacing: -0.015em;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Who's in it ---------- */

.people { padding: 2px 20px 6px; }
.people-row { display: flex; flex-wrap: wrap; gap: 10px; }
.person {
  display: flex; align-items: center; gap: 10px;
  min-height: 60px; padding: 9px 16px 9px 10px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
  text-align: left; max-width: 100%;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.person:hover { border-color: var(--accent-line); }
.person:active { transform: scale(0.98); }
.person[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); }
.person .avatar { width: 40px; height: 40px; font-size: 16px; }
.person .avatar.member { background: color-mix(in srgb, var(--m) 16%, var(--surface)); color: var(--m); }
.person-text { display: flex; flex-direction: column; min-width: 0; }
.person-name { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 16px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-name .dot-m { width: 9px; height: 9px; flex: none; }
.person-name .you { font-weight: 400; color: var(--text-3); }
.person-state { font-size: 14px; line-height: 1.3; color: var(--text-3); white-space: nowrap; }
.person-state.online { color: color-mix(in srgb, var(--c-teal) 80%, var(--text)); font-weight: 600; }
.person-state.agent { color: var(--accent); font-weight: 500; }
.person.invite { border-style: dashed; box-shadow: none; background: transparent; }
.person.more { justify-content: center; min-width: 60px; padding: 9px 16px; font-weight: 600; font-size: 16px; color: var(--text-2); }

@media (max-width: 899px) {
  .people { padding: 2px 16px 6px; }
  .people-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .person { padding-right: 10px; }
  .person-name .you { display: none; }
}

/* The small card that opens under a person. */
.person-card {
  position: absolute; z-index: 40;
  padding: 16px; border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow-lg);
  animation: card-in var(--fast) var(--ease);
}
@keyframes card-in { from { opacity: 0; transform: translateY(-4px); } }
.pc-head { display: flex; align-items: center; gap: 12px; }
.pc-head .avatar.member { background: color-mix(in srgb, var(--m) 16%, var(--surface)); color: var(--m); }
.pc-name { font-weight: 650; font-size: 17px; }
.pc-facts { margin: 14px 0 12px; display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; font-size: 15px; }
.pc-facts dt { color: var(--text-3); font-weight: 500; }
.pc-facts dd { margin: 0; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.pc-state { font-weight: 600; }
.pc-sub { font-size: 13px; color: var(--text-3); }
.pc-none { color: var(--text-3); }

/* ---------- Live preview ---------- */
/* Desktop: talk on the left third, the running project on the right two
   thirds. Phone: the preview on top, the talk below it. */

.preview {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow);
}
.pv-bar {
  display: flex; align-items: center; gap: 4px;
  min-height: 52px; padding: 6px 8px 6px 16px;
  border-bottom: 1px solid var(--border);
  transition: background-color 900ms var(--ease);
}
.pv-bar.fresh { animation: pv-fresh 2.4s var(--ease); }
@keyframes pv-fresh { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
.pv-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pv-title { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: 15px; }
.pv-live { width: 8px; height: 8px; border-radius: 50%; background: var(--c-teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-teal) 22%, transparent); }
.pv-meta { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-bar .btn { flex: none; }
.pv-bar .btn svg.icon { width: 16px; height: 16px; }

.pv-stage { position: relative; flex: 1; min-height: 0; background: #fff; }
.pv-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.pv-frame.pv-behind { opacity: 0; pointer-events: none; }

.pv-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 28px 24px; text-align: center; color: var(--text-2);
}
.pv-empty h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.pv-empty p { max-width: 380px; font-size: 15px; line-height: 1.45; }
.pv-empty .btn { margin-top: 8px; }
.pv-icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 4px;
}
.pv-icon svg.icon { width: 28px; height: 28px; }

@media (max-width: 899px) {
  /* The shell's parts become siblings of the preview so it can sit under the title. */
  .stage.with-preview { display: flex; flex-direction: column; min-height: 100dvh; max-width: 640px; margin: 0 auto; }
  .stage.with-preview > .shell { display: contents; }
  .stage.with-preview .topbar { order: 0; }
  .stage.with-preview .preview { order: 1; }
  .stage.with-preview .people { order: 2; padding-top: 12px; }
  .stage.with-preview main.view { order: 3; }
  .preview { margin: 0 16px 4px; height: 46dvh; min-height: 280px; max-height: 560px; }
  .pv-bar { padding-left: 14px; gap: 0; }
  .pv-open span { display: none; }
  .pv-bar .btn { padding-left: 10px; padding-right: 10px; }
  .pv-empty { padding: 20px; gap: 8px; }
  .pv-empty .pv-icon { width: 48px; height: 48px; }
}

@media (min-width: 900px) {
  .stage.with-preview {
    display: grid; grid-template-columns: minmax(340px, 1fr) minmax(0, 2fr);
    align-items: start; min-height: 100dvh;
  }
  .stage.with-preview > .shell { width: 100%; max-width: none; margin: 0; }
  .stage.with-preview .nav { position: sticky; left: auto; right: auto; bottom: 0; }
  .stage.with-preview .nav-inner { max-width: none; }
  .stage.with-preview main.view { padding-bottom: 28px; }
  .stage.with-preview .preview {
    position: sticky; top: 0;
    height: calc(100dvh - 24px); margin: 12px 12px 12px 0;
  }
}

/* ---------- Team chat (the social corner) ---------- */
/* Desktop: a small box in the top right of the talk panel, folding into a
   pill. Phone: a floating button that opens a sheet. */

.corner { position: absolute; top: calc(100% + 2px); right: 12px; z-index: 5; display: flex; justify-content: flex-end; }
.corner:empty { display: none; }

.chat-box {
  width: 300px; max-width: calc(100vw - 24px); height: min(380px, 62dvh);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow-lg);
  animation: card-in var(--fast) var(--ease);
}
.chat-head { display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px 14px; border-bottom: 1px solid var(--border); }
.chat-title { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: 15px; }
.chat-title svg.icon { width: 18px; height: 18px; color: var(--accent); }
.chat-sub { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-min { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; display: grid; place-items: center; background: none; color: var(--text-2); }
.chat-min:hover { background: var(--surface-2); }

.chat-thread { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px 4px; }
.chat-empty { height: 100%; display: grid; place-items: center; align-content: center; gap: 10px; padding: 12px; text-align: center; }
.chat-empty p, .sheet .chat-empty p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text-3); }

.cm { margin-bottom: 12px; }
.cm.fresh { animation: view-in var(--slow) var(--ease); }
.cm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cm-head .name-chip { font-size: 13px; padding: 1px 8px 1px 6px; gap: 5px; }
.cm-head .name-chip .dot-m { width: 7px; height: 7px; }
.cm-head time { font-size: 12px; color: var(--text-3); }
.cm-text {
  display: inline-block; max-width: 100%;
  padding: 7px 12px; border-radius: 14px; background: var(--surface-2);
  font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere;
}
.cm.mine .cm-text, .cm.mine .cm-voice { background: var(--accent-soft); }

.cm-voice {
  display: inline-flex; align-items: center; gap: 10px; width: 210px; max-width: 100%;
  padding: 5px 12px 5px 5px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text);
}
.cm-play { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; }
.cm-play svg.icon { width: 14px; height: 14px; fill: currentColor; stroke-width: 0; }
.cm-voice.loading .cm-play { opacity: 0.6; }
.cm-track { flex: 1; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--text-3) 30%, transparent); overflow: hidden; }
.cm-progress { display: block; width: 0; height: 100%; background: var(--accent); transition: width 240ms linear; }
.cm-len { flex: none; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.chat-compose { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 10px; border-top: 1px solid var(--border); }
.chat-compose textarea {
  flex: 1; min-width: 0; resize: none; height: 38px; min-height: 38px; max-height: 120px;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 18px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 15px; line-height: 1.35;
}
.chat-compose textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-compose textarea[hidden], .chat-rec[hidden] { display: none; }
.chat-act {
  flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-2); color: var(--text-2);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.chat-act:hover { color: var(--accent); }
.chat-act.send { background: var(--accent); color: #fff; }
.chat-act.send svg.icon { stroke-width: 2.4; }
.chat-act.recording { background: var(--danger); color: #fff; transform: scale(1.15); box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 18%, transparent); }
.chat-rec { flex: 1; min-width: 0; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 4px; font-size: 14px; }
.rec-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s var(--ease) infinite; }
.rec-time { flex: none; font-weight: 650; font-variant-numeric: tabular-nums; }
.rec-hint { min-width: 0; color: var(--text-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-rec.cancel .rec-hint { color: var(--danger); }
.chat-note, .sheet .chat-note { margin: 0; padding: 0 14px 8px; font-size: 13px; color: var(--text-2); }
.chat-note:empty { display: none; }

.chat-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 12px 0 11px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  font-size: 14px; font-weight: 600;
}
.chat-pill svg.icon { width: 17px; height: 17px; color: var(--accent); }
.chat-pill:hover { border-color: var(--accent-line); }
.chat-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: inline-grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.chat-count[hidden] { display: none; }

.chat-fab {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 35;
  width: 56px; height: 56px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: var(--shadow-lg);
}
.chat-fab svg.icon { width: 26px; height: 26px; }
.chat-fab:active { transform: scale(0.95); }
.chat-fab .chat-count { position: absolute; top: -3px; right: -3px; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }

.sheet.chat-sheet { height: 84dvh; display: flex; flex-direction: column; overflow: hidden; padding-left: 0; padding-right: 0; }
.chat-sheet > h2 { padding: 0 20px; margin-bottom: 0; }
.chat-sheet .chat-head { padding: 0 20px 10px; }
.chat-sheet .chat-thread { padding: 12px 20px 4px; }
.chat-sheet .chat-compose { padding: 10px 16px 0; }
.chat-sheet .actions { display: none; }

@media (min-width: 900px) { .chat-fab { display: none; } }

/* ---------- Team AI (the main talk panel) ---------- */

.talk { display: flex; flex-direction: column; gap: 10px; }
.talk-status:empty { display: none; }
.talk-status { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.talk-now, .talk-next { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; font-size: 15px; }
.talk-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }
.talk-progress { font-size: 13.5px; color: var(--text-2); }
.talk-q { display: inline-flex; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); font-size: 14px; }

.talk-thread { display: flex; flex-direction: column; gap: 14px; padding: 4px 0; }
.talk-loading { display: grid; place-items: center; padding: 28px; }
.talk-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 12px 12px; text-align: center; color: var(--text-2); }
.talk-empty h2 { font-size: 19px; font-weight: 650; color: var(--text); }
.talk-empty p { font-size: 15px; line-height: 1.45; max-width: 420px; }

.tm.fresh { animation: view-in var(--slow) var(--ease); }
.tm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.tm-head time { font-size: 12px; color: var(--text-3); }
.tm-head .name-chip { font-size: 13.5px; padding: 2px 9px 2px 7px; gap: 6px; }
.tm-body {
  display: inline-block; max-width: 100%;
  padding: 9px 13px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--border);
  font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.tm.mine .tm-body { background: var(--accent-soft); border-color: transparent; }
.tm.ai .tm-body { background: var(--surface); box-shadow: var(--shadow-sm); }
.tm.note-done .tm-body, .tm.note-started .tm-body, .tm.note-queued .tm-body { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.tm.note-limit .tm-body, .tm.note-error .tm-body { background: var(--surface-2); border-color: transparent; color: var(--text-2); }
.talk-detail { margin-top: 6px; font-size: 14px; color: var(--text-2); white-space: pre-wrap; }

.ai-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px 2px 7px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-size: 13.5px; font-weight: 650;
}
.ai-chip svg.icon { width: 14px; height: 14px; stroke-width: 2.2; }

.talk-tasks { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.task {
  padding: 10px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--m) 7%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--m) 18%, var(--border));
}
.task-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.task-top .name-chip { font-size: 13px; padding: 1px 8px 1px 6px; gap: 5px; }
.task-kicker { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.task-kicker svg.icon { width: 13px; height: 13px; }
.task-state { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-3); }
.task-state svg.icon { width: 14px; height: 14px; stroke-width: 2.4; }
.task.claimed .task-state { color: var(--text-2); font-weight: 600; }
.task.proof .task-state { color: var(--accent); font-weight: 650; }
.task.approved .task-state { color: color-mix(in srgb, var(--c-teal) 80%, var(--text)); font-weight: 600; }
.task.waiting { background: var(--surface-2); border-color: var(--border); }
.task-title { margin-top: 6px; font-weight: 600; font-size: 15px; line-height: 1.35; }
.task-detail { margin-top: 3px; font-size: 14px; line-height: 1.4; color: var(--text-2); }
.task .btn { margin-top: 8px; }
.lane-tasks { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

.talk-typing { display: flex; align-items: center; gap: 10px; }
.talk-typing[hidden] { display: none; }
.dots { display: inline-flex; gap: 4px; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: pulse 1.2s var(--ease) infinite; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

.talk-compose {
  position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); z-index: 4;
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.talk-compose textarea {
  flex: 1; min-width: 0; resize: none; height: 40px; min-height: 40px; max-height: 160px;
  padding: 9px 10px; border: 0; border-radius: 14px; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; line-height: 1.4;
}
.talk-compose textarea:focus { outline: none; box-shadow: none; }
.talk-send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; }
.talk-send:disabled { background: var(--surface-2); color: var(--text-3); }
.talk-send svg.icon { stroke-width: 2.4; }
.talk-note { margin: 0; font-size: 14px; color: var(--danger); }
.talk-note:empty { display: none; }
.talk-setup { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.talk-setup h2 { font-size: 19px; font-weight: 650; }
.talk-setup p { color: var(--text-2); line-height: 1.45; }
.talk-setup .pv-icon { margin-bottom: 2px; }

@media (min-width: 900px) {
  .stage.with-preview .talk-compose { bottom: calc(var(--nav-h) + 8px); }
}
@media (max-width: 899px) {
  body[data-tab="talk"] .chat-fab { bottom: calc(var(--nav-h) + var(--safe-b) + 84px); }
}

/* ---------- Point-and-ask ---------- */

.pv-point.active, #preview.pointing .pv-point { background: var(--accent-soft); color: var(--accent); }
.pv-pick { position: absolute; inset: 0; z-index: 6; cursor: crosshair; touch-action: none; background: rgba(20, 20, 18, 0.08); }
.pv-pick-hint {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 20px);
  padding: 6px 6px 6px 14px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: default;
  box-shadow: var(--shadow-lg);
}
.pv-pick.dragging .pv-pick-hint, .pv-pick.has-box .pv-pick-hint { opacity: 0; pointer-events: none; }
.pv-pick-x { width: 26px; height: 26px; border: 0; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 18%, transparent); color: inherit; }
.pv-pick-x svg.icon { width: 15px; height: 15px; }
.pv-box {
  position: absolute; box-sizing: border-box; border: 2px solid var(--accent); border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: 0 0 0 9999px rgba(20, 20, 18, 0.18);
}

.pv-ask {
  position: absolute; z-index: 7; display: flex; flex-direction: column; gap: 10px;
  padding: 12px; border-radius: 16px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); cursor: default;
  animation: card-in var(--fast) var(--ease);
}
.pv-ask textarea { min-height: 0; height: auto; resize: none; font-size: 15px; padding: 9px 11px; border-radius: 12px; }
.pv-toggle { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; cursor: pointer; user-select: none; }
.pv-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.pv-switch { position: relative; width: 34px; height: 20px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); transition: background-color var(--fast) var(--ease); }
.pv-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-3); transition: transform var(--fast) var(--ease), background-color var(--fast) var(--ease); }
.pv-toggle input:checked + .pv-switch { background: var(--accent); border-color: var(--accent); }
.pv-toggle input:checked + .pv-switch::after { transform: translateX(14px); background: #fff; }
.pv-toggle input:focus-visible + .pv-switch { box-shadow: 0 0 0 3px var(--accent-soft); }
.pv-choices { display: flex; flex-direction: column; gap: 6px; }
.pv-choices[hidden] { display: none; }
.pv-choices .text { padding: 7px 10px; font-size: 14px; border-radius: 10px; }
.pv-choices .link-btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; }
.pv-choices .link-btn svg.icon { width: 15px; height: 15px; }
.pv-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pv-mode button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 7px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); text-align: left;
}
.pv-mode button b { font-size: 14px; }
.pv-mode button span { font-size: 12px; color: var(--text-3); }
.pv-mode button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.pv-ask-error { margin: 0; font-size: 13px; color: var(--danger); }
.pv-ask-error:empty { display: none; }
.pv-ask-actions { display: flex; justify-content: flex-end; gap: 6px; }
.pv-ask-actions .btn svg.icon { width: 15px; height: 15px; }

/* A teammate's spot, outlined on your own preview. */
.pv-spot {
  position: absolute; z-index: 5; pointer-events: none; box-sizing: border-box;
  border: 2px solid var(--accent); border-radius: 6px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
  animation: spot-in 600ms var(--ease);
}
@keyframes spot-in { from { opacity: 0; transform: scale(1.06); } }
.pv-spot-tag {
  position: absolute; left: -2px; bottom: calc(100% + 4px); pointer-events: auto;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  padding: 2px 4px 2px 9px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 650;
}
.pv-spot-tag button { width: 20px; height: 20px; border: 0; border-radius: 50%; display: grid; place-items: center; background: none; color: inherit; }
.pv-spot-tag button svg.icon { width: 13px; height: 13px; }

/* In the team chat. */
.cm.point .cm-point { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 100%; }
.pt-shot { display: block; max-width: 100%; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.pt-shot img { display: block; max-width: 100%; max-height: 180px; min-width: 60px; min-height: 30px; object-fit: contain; }
.pt-spot {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px; border: 1px dashed var(--accent-line); border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); font-size: 13.5px; font-weight: 600;
}
.pt-spot svg.icon { width: 16px; height: 16px; }
.cm.flash { animation: cm-flash 1.6s var(--ease); border-radius: 12px; }
@keyframes cm-flash { 0%, 50% { background: var(--accent-soft); } 100% { background: transparent; } }

.poll { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.poll-opt {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px;
  width: 100%; padding: 7px 11px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); text-align: left;
}
.poll-opt:not(:disabled):hover { border-color: var(--accent-line); }
.poll-fill { position: absolute; inset: 0 auto 0 0; background: var(--surface-2); transition: width 400ms var(--ease); }
.poll-opt.mine { border-color: var(--accent); }
.poll-opt.mine .poll-fill { background: var(--accent-soft); }
.poll-opt.won { border-color: color-mix(in srgb, var(--c-teal) 60%, var(--border)); }
.poll-opt.won .poll-fill { background: color-mix(in srgb, var(--c-teal) 14%, var(--surface)); }
.poll-opt > span:not(.poll-fill) { position: relative; }
.poll-label { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 14.5px; }
.poll-label svg.icon { width: 15px; height: 15px; stroke-width: 2.6; color: color-mix(in srgb, var(--c-teal) 80%, var(--text)); }
.poll-count { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.poll-who { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.poll-who .dot-m { width: 7px; height: 7px; }
.poll-opt:disabled { cursor: default; }
.poll-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-3); }
.poll-foot .link-btn { font-size: 13px; }
.poll.closed .poll-foot { color: var(--text-2); }

/* Nudge: at the top of a teammate's screen. */
.nudge {
  position: fixed; top: calc(var(--safe-t) + 12px); left: 50%; z-index: 95;
  width: min(460px, calc(100vw - 24px));
  display: flex; align-items: stretch; gap: 4px;
  padding: 8px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  transform: translate(-50%, -140%); transition: transform 280ms var(--ease);
}
.nudge.show { transform: translate(-50%, 0); }
.nudge-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 4px; border: 0; border-radius: 12px; background: none; color: var(--text); text-align: left; }
.nudge-open:hover { background: var(--surface-2); }
.nudge-open img, .nudge-spot { flex: none; width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); }
.nudge-spot { display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.nudge-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nudge-title { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 14.5px; font-weight: 600; }
.nudge-title .name-chip { font-size: 13.5px; padding: 1px 8px 1px 6px; gap: 5px; }
.nudge-words { font-size: 15px; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nudge-poll { font-size: 12.5px; font-weight: 600; color: var(--accent); }
.nudge-x { flex: none; align-self: flex-start; width: 32px; height: 32px; border: 0; border-radius: 50%; display: grid; place-items: center; background: none; color: var(--text-3); }
.nudge-x:hover { background: var(--surface-2); }

@media (max-width: 899px) {
  .pv-point span { display: none; }
}

/* ---------- Shared project ---------- */

.task-link { margin-top: 8px; padding: 9px 11px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.task-link-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; font-weight: 650; }
.task-link-head svg.icon { width: 14px; height: 14px; color: var(--accent); }
.task-link-head span { font-weight: 500; color: var(--text-2); }
.task-link p { margin: 4px 0 0; font-size: 14px; line-height: 1.4; color: var(--text); }
.task-link .task-link-note { font-size: 12.5px; color: var(--text-3); }
.task-state.needs { color: var(--danger); font-weight: 650; }
.task-blocked { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 9%, var(--surface)); font-size: 14px; line-height: 1.4; }

.repo-form { align-items: flex-end; flex-wrap: wrap; }
.repo-form .grow { min-width: 220px; }
.repo-form-actions { display: flex; gap: 6px; }
.repo-error { margin: 6px 0 0; font-size: 13.5px; color: var(--danger); }
.repo-error:empty { display: none; }
.repo-steps .title { margin-bottom: 6px; }
.repo-checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.repo-checklist li { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; line-height: 1.4; color: var(--text-2); }
.repo-check { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--border); color: transparent; }
.repo-check svg.icon { width: 13px; height: 13px; stroke-width: 3; }
.repo-checklist li.done { color: var(--text); }
.repo-checklist li.done .repo-check { background: var(--c-teal); border-color: var(--c-teal); color: #fff; }
.repo-checklist .link-btn { margin-left: 4px; font-size: 14px; }
.repo-person { gap: 10px; }
.repo-person .name-chip { font-size: 14px; flex: none; }
.repo-status { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--text-3); }
.repo-status svg.icon { width: 15px; height: 15px; stroke-width: 2.6; }
.repo-status.ready { color: color-mix(in srgb, var(--c-teal) 80%, var(--text)); font-weight: 600; }
.repo-status.invited { color: var(--text-2); }
.repo-status.error { color: var(--danger); }

/* ---------- Roles ---------- */

.role-chip {
  display: inline-flex; align-items: center; vertical-align: 1px;
  padding: 1px 8px; border-radius: 999px; margin-left: 4px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 12px; font-weight: 650; letter-spacing: 0.01em;
}
.role-chip.owner { background: var(--accent-soft); color: var(--accent); }
.role-chip.viewer { background: transparent; border: 1px solid var(--border); }

.role-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.role-pick button {
  padding: 7px 6px; border: 0; border-radius: 9px; background: none; color: var(--text-2);
  font-size: 14px; font-weight: 600;
}
.role-pick button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.role-pick button:disabled { opacity: 0.6; }
.role-pick.wide { grid-template-columns: 1fr; gap: 6px; padding: 0; background: none; }
.role-pick.wide button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.role-pick.wide button b { font-size: 15px; color: var(--text); }
.role-pick.wide button span { font-size: 13px; font-weight: 400; color: var(--text-3); line-height: 1.35; }
.role-pick.wide button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }

.pc-role { margin-top: 12px; }
.pc-role-line { display: flex; align-items: center; gap: 8px; }
.pc-role-label { font-size: 14px; font-weight: 500; color: var(--text-3); }
.pc-role-line .role-chip { margin-left: 0; font-size: 13px; padding: 2px 10px; }
.pc-role-hint { margin: 6px 0 0; font-size: 13px; line-height: 1.4; color: var(--text-3); }
.pc-role-error { margin: 4px 0 0; font-size: 13.5px; color: var(--danger); }
.pc-role-error:empty { display: none; }
.pc-remove { display: block; margin: 10px auto 0; font-size: 14px; color: var(--danger); }

.talk-viewer { margin: 0; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); color: var(--text-2); font-size: 15px; text-align: center; }
.check-who { text-align: center; margin: 10px 0 2px; }

/* ---------- What we've learned (the team AI's notebook) ---------- */

.notebook {
  margin-bottom: 20px; padding: 16px 16px 12px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
  scroll-margin-top: 90px;
  transition: box-shadow var(--slow) var(--ease);
}
.notebook.ping { box-shadow: 0 0 0 3px var(--accent-line), var(--shadow); }
.notebook-head { display: flex; align-items: center; gap: 10px; }
.notebook-head h2 { flex: 1; display: flex; align-items: center; gap: 8px; margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.notebook-head h2 svg.icon { width: 20px; height: 20px; color: var(--accent); }
.notebook-count { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.notebook-sub { margin: 4px 0 10px; font-size: 14px; color: var(--text-2); }
.notebook-empty { margin: 4px 0 6px; font-size: 15px; color: var(--text-2); }
.lessons { list-style: none; margin: 0; padding: 0; }
.lesson { padding: 12px 0; }
.lesson + .lesson { border-top: 1px solid var(--border); }
.lesson.leaving { opacity: 0.4; }
.lesson-text { font-size: 16px; font-weight: 500; color: var(--text); }
.lesson-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 5px; font-size: 13px; color: var(--text-3); }
.lesson-for {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px 2px 7px; border-radius: 999px; font-weight: 600; color: var(--text-2);
  background: color-mix(in srgb, var(--m, var(--text-3)) 12%, var(--surface));
}
.lesson-for .dot-m { width: 7px; height: 7px; }
.lesson-for.team { background: var(--surface-2); }
.lesson-actions { display: flex; gap: 4px; margin: 2px 0 -8px -12px; }
.lesson-actions .link-btn { min-height: 40px; padding: 8px 12px; font-size: 14px; }
.link-btn.danger { color: var(--danger); }
.lesson-edit { display: flex; flex-direction: column; gap: 8px; }
.lesson-edit-actions { display: flex; gap: 8px; }
.lesson-error { margin: 0; font-size: 14px; color: var(--danger); }
.lesson-error:empty { display: none; }
.notebook-replaced { margin-top: 6px; font-size: 14px; color: var(--text-3); }
.notebook-replaced summary { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; cursor: pointer; list-style: none; }
.notebook-replaced summary::-webkit-details-marker { display: none; }
.notebook-replaced summary svg.icon { width: 16px; height: 16px; transition: transform var(--fast) var(--ease); }
.notebook-replaced[open] summary svg.icon { transform: rotate(90deg); }
.notebook-replaced ul { list-style: none; margin: 0 0 4px; padding: 0; }
.notebook-replaced li { display: flex; flex-direction: column; padding: 6px 0; }
.notebook-replaced li span { color: var(--text-2); }

/* "Following what we learned" on a card. */
.task-learned {
  display: flex; align-items: flex-start; gap: 7px;
  margin-top: 8px; padding: 8px 10px; border-radius: 10px;
  background: var(--accent-soft); color: var(--text-2); font-size: 13.5px; line-height: 1.4;
}
.task-learned svg.icon { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--accent); }
.task-learned b { color: var(--text); font-weight: 600; }

/* "Noted: ..." in the team AI conversation: small, and opens the notebook. */
.tm.note-learned { align-items: center; }
.learned-note {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; max-width: 100%;
  padding: 7px 12px; border: 1px solid var(--accent-line); border-radius: 999px;
  background: var(--accent-soft); color: var(--text); font-size: 14px; text-align: left; cursor: pointer;
}
.learned-note svg.icon { width: 15px; height: 15px; color: var(--accent); }
.learned-go { color: var(--accent); font-weight: 600; font-size: 13px; }
.learned-note:hover .learned-go { text-decoration: underline; }

/* Under the fix note on a team AI card. */
.compose-hint { margin: 2px 0 4px; font-size: 14px; }
