:root {
  font: 16px system-ui, sans-serif;
  color: #202c29;
  background: #f7f8f7;
  --green: #225d48;
  --muted: #536760;
  --line: #dce6e0;
  --gutter: max(clamp(.85rem, 4vw, 2rem), calc((100% - 48rem) / 2));
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; overscroll-behavior: none; }
main { height: 100dvh; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.conversation {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: #f7f8f7;
}
/* Explicit rows (2026-11-22): with #statusbar hidden, auto-placement put the
   thread in the `auto` row and the footer in the 1fr row, so the composer
   floated mid-screen on short threads. Pin each part to its row. */
.conversation > header { grid-row: 1; }
#statusbar { grid-row: 2; }
#thread { grid-row: 3; }
.conversation > footer { grid-row: 4; }
#sidebar {
  overflow: auto;
  padding: 1.25rem .85rem;
  background: #f0f2f0;
  border-right: 1px solid var(--line);
}
#sidebar h2 { margin: 0 .5rem .85rem; font-size: 1.15rem; }
#sidebar-new-task { width: 100%; margin-bottom: 1rem; }
.project { margin-top: 1rem; }
.project h3 { margin: 0 .55rem .3rem; font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.task-row {
  display: flex;
  align-items: center;
  gap: .35rem;
  width: 100%;
  min-height: 2.25rem;
  padding: .4rem .55rem;
  border-color: transparent;
  background: transparent;
  text-align: left;
}
.task-row:hover { background: #e6ebe6; }
.task-row[aria-current] { background: #dceee4; color: var(--green); }
.task-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row small { flex: none; white-space: nowrap; font-size: .7rem; }
.status-dot { flex: none; width: .45rem; height: .45rem; border-radius: 50%; background: #6f817b; }
.status-dot.working { background: #5378a6; }
.status-dot.delivered { background: #217653; }
.status-dot.rework { background: #a36426; }
.status-dot.signed { background: #8b978f; }
#menu { display: none; }
#scrim { position: fixed; inset: 0; z-index: 1; background: rgb(22 35 30 / 42%); }
@media (width < 900px) {
  main { grid-template-columns: minmax(0, 1fr); }
  #menu { display: block; }
  #sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 85vw);
    z-index: 2;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  #sidebar.open { transform: translateX(0); }
}
header, footer, #thread { padding-inline: var(--gutter); }
header {
  padding-block: .85rem;
  display: flex;
  gap: .8rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.avatar { background: var(--green); color: white; padding: .55rem .75rem; border-radius: .75rem; font-weight: 700; }
header > div:nth-of-type(2) { min-width: 0; flex: 1; }
header h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.whoami { flex-shrink: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h1 { font-size: 1.15rem; margin: 0; }
small { color: var(--muted); font-size: .8rem; }
#thread { overflow: auto; padding-block: 1rem; display: flex; flex-direction: column; gap: .8rem; }
#thread > article { flex-shrink: 0; padding: .75rem 1rem; border-radius: 1rem; overflow-wrap: anywhere; }
#thread > .bubble {
  position: relative;
  align-self: flex-start;
  max-width: 88%;
  margin-left: 2.35rem;
  border: 1px solid var(--line);
  border-bottom-left-radius: .25rem;
  background: white;
}
.bubble.manager::before {
  content: '管';
  position: absolute;
  top: 0;
  right: calc(100% + .5rem);
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: #e5eee8;
  color: var(--green);
  font-size: .75rem;
}
#thread > .bubble.member {
  align-self: flex-end;
  margin-left: 0;
  border-color: transparent;
  border-bottom-left-radius: 1rem;
  border-bottom-right-radius: .25rem;
  background: #dceee4;
}
.bubble p { margin: .25rem 0 0; white-space: pre-wrap; }
.card { background: #fff; border: 1px solid var(--line); }
.card h2 { margin: 0 0 .35rem; font-size: 1rem; }
.engine-badge, .status-badge { display: inline-block; padding: .1rem .45rem; border-radius: 1rem; background: #dceee4; }
.card .engine-badge { margin-left: .35rem; }
.card button { margin: .4rem .4rem 0 0; max-width: 100%; overflow-wrap: anywhere; }
.card .file-chip { border-radius: 1rem; background: #f0f2f0; }
.bubble .file-chip { border-radius: 1rem; background: #f0f2f0; display: inline-block; }
#notice:not(:empty) { margin-bottom: .5rem; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: .25rem; font-size: .85rem; }
.engine-options { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .25rem; }
.engine-options label { position: relative; padding: .3rem .65rem; border: 1px solid #bdcdc4; border-radius: 2rem; cursor: pointer; }
.engine-options input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.engine-options label:has(:checked) { background: #dceee4; border-color: var(--green); color: var(--green); }
.engine-options label:has(:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; border: 1px solid #bdcdc4; border-radius: .5rem; background: white; padding: .45rem .65rem; }
textarea { width: 100%; resize: none; max-height: 30vh; border-radius: 1rem; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
.primary { background: var(--green); border-color: var(--green); color: white; }
progress { width: 100%; accent-color: var(--green); }

/* ===== Composer (2026-11-22 redesign, modelled on the Muse app composer) =====
   Resting state is one pill: [+] [textarea] [send]. "+" slides a chip row out
   above the pill. New-task / rework turn the whole form into one card whose
   bottom row is the same pill, so the send/submit button never moves.
   Geometry: 44px hit targets (--btn), 52px pill (44 + 2x3px padding + 2x1px
   border), radius = half the pill height. Visual circles are 36px, drawn
   inside the 44px hit area with a transparent 4px border. */
footer {
  position: relative;
  padding-block: .5rem max(.75rem, env(safe-area-inset-bottom));
  background: #f7f8f7;
}
/* Thread content dissolves into the composer instead of being cut by a line. */
footer::before {
  content: '';
  position: absolute;
  inset: auto 0 100% 0;
  height: 1rem;
  background: linear-gradient(rgb(247 248 247 / 0), #f7f8f7);
  pointer-events: none;
}
/* Keyboard up (iOS): the home-indicator inset sits under the keyboard, so drop it. */
#notice { padding-inline: .9rem; font-size: .85rem; color: var(--muted); }
#progress { display: block; height: 4px; margin: 0 .9rem .5rem; width: auto; }

#compose {
  --btn: 2.75rem;
  --pill-h: 3.25rem;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --surface-shadow: 0 1px 1px rgb(22 35 30 / 4%), 0 4px 16px -4px rgb(22 35 30 / 12%);
  --surface-shadow-focus: 0 1px 1px rgb(22 35 30 / 5%), 0 8px 24px -6px rgb(22 35 30 / 18%);
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid transparent;
  border-radius: 1.625rem;
  transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
#compose > * { margin-bottom: .5rem; }
#compose > .pill { margin-bottom: 0; }
/* The pill's own border/padding is moved onto the form in card mode; offset
   the resting pill by the form's 1px border so nothing shifts between modes. */
#compose { margin-inline: -1px; }

/* --- The pill --- */
.pill {
  display: flex;
  align-items: flex-end;
  gap: .125rem;
  min-height: var(--pill-h);
  padding: 3px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: calc(var(--pill-h) / 2);
  box-shadow: var(--surface-shadow);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.pill:focus-within { border-color: #bdcdc4; box-shadow: var(--surface-shadow-focus); }
.pill textarea {
  flex: 1;
  width: auto;
  min-width: 0;
  min-height: var(--btn);
  max-height: min(30vh, calc(100dvh * .3));
  margin: 0;
  padding: .6875rem .375rem;      /* 11px + 22px line + 11px = 44px: centred on the buttons */
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 1rem;                /* >= 16px: no iOS focus zoom */
  line-height: 1.375rem;
  caret-color: var(--green);
  overflow-y: auto;
  scrollbar-width: thin;
}
.pill textarea:focus { outline: none; }
.pill textarea::placeholder, #compose #title::placeholder { color: #8b9b94; opacity: 1; }

/* Round buttons: 44px hit area, 36px visible disc. */
#expand, #submit {
  flex: none;
  height: var(--btn);
  min-height: 0;
  margin: 0;
  border: 4px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
#expand {
  display: grid;
  place-items: center;
  width: var(--btn);
  padding: 0;
  font-size: 0;                   /* the "＋" text stays for a11y tools; glyph is drawn */
  background-color: #eef3ef;
  color: var(--muted);
  transition: transform .13s ease, opacity .13s ease, background-color .2s ease, color .2s ease;
}
#expand::before, #submit[aria-label="发送"]::before, #attach::before {
  content: '';
  display: block;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
#expand::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 5v14M5 12h14' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  width: 1.25rem;
  height: 1.25rem;
  transition: transform .34s var(--ease);
}
#expand[aria-expanded="true"] { background-color: #dceee4; color: var(--green); }
#expand[aria-expanded="true"]::before { transform: rotate(45deg); }
#expand:focus-visible, #submit:focus-visible, .actions button:focus-visible, .staged-x:focus-visible {
  outline: 2px solid rgb(34 93 72 / .45);
  outline-offset: -2px;
}

#submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.05rem;
  background-color: var(--green);
  color: #fff;
  font-size: .9375rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
#submit[aria-label="发送"] { width: var(--btn); padding: 0; font-size: 0; }
#submit[aria-label="发送"]::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 19V5.5M6 11l6-6 6 6' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  width: 1.125rem;
  height: 1.125rem;
}
/* Nothing typed yet: the send disc rests in a quiet tint and fills in on the first character. */
#compose:not(.has-text) #submit[aria-label="发送"] { background-color: #b7cbc0; }

/* --- Tools row ("+" expanded): chips slide up out of the pill --- */
#compose .actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: .5rem;
  max-height: 0;
  margin-bottom: 0;
  padding: 0 .25rem;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(.5rem);
  transition: max-height .3s var(--ease), margin-bottom .3s var(--ease), padding .3s var(--ease),
    opacity .16s ease, transform .3s var(--ease), visibility 0s linear .3s;
}
#compose.tools-open .actions, #compose.mode-task .actions {
  max-height: 3.75rem;
  margin-bottom: .5rem;
  padding-block: 2px 4px;
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: max-height .32s var(--ease), margin-bottom .32s var(--ease), padding .32s var(--ease),
    opacity .22s ease .04s, transform .32s var(--ease), visibility 0s;
}
.actions button {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  min-height: var(--btn);
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #2b3a35;
  font-size: .9375rem;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgb(22 35 30 / 6%);
}
#compose.tools-open .actions button { animation: chipIn .34s var(--ease) backwards; }
#compose.tools-open .actions button + button { animation-delay: .04s; }
@keyframes chipIn { from { opacity: 0; transform: translateY(6px) scale(.96); } }
#new-task { color: var(--green); font-weight: 500; }
#attach::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.5 11.6l-8.2 8.2a5.2 5.2 0 0 1-7.4-7.4l8.6-8.6a3.5 3.5 0 0 1 4.9 4.9l-8.6 8.6a1.75 1.75 0 0 1-2.5-2.5l7.9-7.9' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  width: 1.05rem;
  height: 1.05rem;
  color: var(--green);
}

/* --- Staged files: soft chips directly above the bar --- */
#staged { display: flex; flex-wrap: wrap; gap: .375rem; padding: 0 .25rem; }
.staged-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 2.25rem;
  padding-left: .75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #2b3a35;
  font-size: .8125rem;
  animation: chipIn .3s var(--ease) backwards;
}
.staged-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staged-x {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--btn);
  height: var(--btn);
  margin: -.25rem -.3rem -.25rem -.35rem;
  padding: 0;
  border: 10px solid transparent;     /* 44px hit, 24px visible disc */
  border-radius: 50%;
  background: #e8efea padding-box;
  color: var(--muted);
  font-size: .625rem;
  line-height: 1;
}

/* --- New-task / rework: the form becomes one card, the pill its bottom row --- */
#compose.mode-task {
  padding: .25rem 4px 4px;        /* -1px margin + 1px border + 4px = resting pill offsets */
  background: #fff;
  border-color: var(--line);
  box-shadow: var(--surface-shadow);
}
#compose.mode-task:focus-within { border-color: #bdcdc4; box-shadow: var(--surface-shadow-focus); }
#compose.mode-task .pill {
  padding: 3px 0 0;
  border: 0;
  border-top: 1px solid #edf2ee;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#compose.mode-task > :not(.pill) { animation: rowIn .3s var(--ease) backwards; }
#compose.mode-task #expand { display: none; }
#compose.mode-task .pill textarea { padding-inline: .75rem .375rem; }
#compose.mode-task #submit { animation: popIn .3s var(--ease) backwards; }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes popIn { from { opacity: 0; transform: scale(.9); } }
/* Card header: mode label on the left, 附件 / 取消 as quiet text buttons on the right. */
#compose.mode-task .actions { order: -1; gap: 0; margin-bottom: 0; padding: 0 0 0 .75rem; }
#compose.mode-task .actions::before {
  content: '新建任务';
  margin-right: auto;
  color: var(--green);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .04em;
}
#compose.mode-rework .actions::before { content: '修改要求'; }
#compose.mode-task .actions button { padding: 0 .8rem; border-color: transparent; background: transparent; box-shadow: none; }
#compose.mode-task #attach { order: 1; color: var(--green); }
#compose.mode-task #new-task { order: 2; color: var(--muted); font-weight: 400; }
#compose #title {
  width: 100%;
  min-height: var(--btn);
  margin: 0 0 .125rem;
  padding: .5rem .75rem;
  border: 0;
  border-radius: .875rem;
  background: transparent;
  font-size: 1.0625rem;
  font-weight: 600;
  transition: background-color .2s ease;
}
#compose #title:focus { outline: none; background: #f4f7f5; }
#compose #title::placeholder { font-weight: 500; }
#compose #engines { margin-bottom: .5rem; padding: 0 .75rem; }
#engines legend {
  float: left;
  margin: 0 .625rem 0 0;
  line-height: var(--btn);
  color: var(--muted);
  font-size: .8125rem;
}
/* Engine picker as a segmented control: 44px-tall segments, the white thumb
   is drawn 3px inside each so the visible control stays slim. */
#engines .engine-options {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0;
  margin: 0;
  border-radius: 999px;
  background: #eef3ef;
}
#engines .engine-options label {
  display: inline-flex;
  align-items: center;
  min-height: var(--btn);
  padding: 0 .9rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: .9375rem;
  isolation: isolate;
  transition: color .2s ease, transform .13s ease;
}
#engines .engine-options label::before {
  content: '';
  position: absolute;
  inset: 3px;
  z-index: -1;
  border-radius: inherit;
  background: #fff;
  box-shadow: 0 1px 3px rgb(22 35 30 / 14%), 0 0 0 .5px rgb(22 35 30 / 6%);
  opacity: 0;
  transform: scale(.92);
  transition: opacity .2s ease, transform .3s var(--ease);
}
#engines .engine-options label:has(:checked) { color: var(--green); font-weight: 600; }
#engines .engine-options label:has(:checked)::before { opacity: 1; transform: none; }
#engines .engine-options label:has(:focus-visible) { outline-offset: -2px; }
#claude-note { display: block; clear: both; padding-top: .125rem; color: #7f8f88; font-size: .75rem; transition: color .2s ease; }
#engines:has([value="claude"]:checked) #claude-note { color: #a36426; }
#compose.mode-task #staged { padding: 0 .5rem; }
#compose.mode-task .staged-chip { background: #f4f7f5; }

@media (hover: hover) {
  #expand:hover { background-color: #e4ece7; }
  #expand[aria-expanded="true"]:hover { background-color: #d2e8dc; }
  #submit:hover { background-color: #1c4f3d; }
  #compose:not(.has-text) #submit[aria-label="发送"]:hover { background-color: #a9c0b4; }
  .actions button:hover { background-color: #f4f7f5; }
  #compose.mode-task .actions button:hover { background-color: #f0f4f1; }
}

[hidden] { display: none !important; }

.typing { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.typing .dots { display: inline-flex; gap: .25rem; }
.typing .dots i { width: .45rem; height: .45rem; border-radius: 50%; background: var(--green); opacity: .3; animation: blink 1.2s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .2s; }
.typing .dots i:nth-child(3) { animation-delay: .4s; }
.typing .phrase { color: var(--muted); font-size: .9rem; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
#thread > :last-child { animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

#statusbar { display: flex; align-items: center; gap: .7rem; padding: .5rem clamp(.85rem, 4vw, 2rem) .65rem; background: #edf4ef; border-bottom: 1px solid #dce6e0; position: relative; }
.robot { position: relative; flex: none; width: 34px; height: 42px; animation: bob 2.2s ease-in-out infinite; }
.robot .antenna { position: absolute; left: 50%; top: 4px; width: 2px; height: 7px; background: #225d48; transform: translateX(-50%); }
.robot .antenna::after { content: ''; position: absolute; left: 50%; top: -6px; width: 7px; height: 7px; border-radius: 50%; background: #e0a100; transform: translateX(-50%); animation: pulseDot 1.6s ease-in-out infinite; }
.robot .head { position: absolute; top: 10px; left: 2px; right: 2px; height: 20px; background: #225d48; border-radius: 7px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.robot .eye { width: 5px; height: 7px; border-radius: 3px; background: #fff; animation: blinkEyes 3.4s infinite; }
.robot .bot-body { position: absolute; bottom: 0; left: 7px; right: 7px; height: 10px; background: #2e7d5f; border-radius: 4px 4px 6px 6px; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5px); } }
@keyframes blinkEyes { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.12); } }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.status-text { display: flex; flex-direction: column; min-width: 0; }
.status-text strong { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-text span { color: #4f635b; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-track { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #d8e4dc; overflow: hidden; }
.status-track i { position: absolute; top: 0; bottom: 0; width: 40%; background: #225d48; border-radius: 2px; animation: slideTrack 1.4s ease-in-out infinite; }
@keyframes slideTrack { 0% { left: -40%; } 100% { left: 100%; } }

.preview-row { margin-top: .5rem; }
.preview-link { display: inline-block; background: #225d48; color: #fff; text-decoration: none; padding: .5rem .9rem; border-radius: .6rem; font-weight: 600; }
.preview-link:active { transform: scale(.97); }

#feedback-open { flex: none; }
.whoami { margin-left: auto; flex: none; font-size: .82rem; color: #6b5ce7; background: #efeaff; border: 1px solid #d9d0ff; padding: .28rem .6rem; border-radius: 999px; white-space: nowrap; }
.whoami:empty { display: none; }
#feedback-panel { border-top: 1px solid var(--line); background: #fff; padding: .8rem var(--gutter); display: grid; gap: .55rem; max-height: 55dvh; overflow: auto; }
/* Dedicated feedback view: thread/composer/status hide, panel takes the space */
.conversation.fb-open #thread, .conversation.fb-open footer, .conversation.fb-open #statusbar { display: none; }
.conversation.fb-open #feedback-panel { grid-row: 3 / 5; max-height: none; align-content: start; }
.fb-head { display: flex; align-items: center; justify-content: space-between; }
.fb-kinds { display: flex; gap: .5rem; }
.fb-kinds label { padding: .3rem .65rem; border: 1px solid #bdcdc4; border-radius: 2rem; cursor: pointer; }
.fb-kinds label:has(:checked) { background: #dceee4; border-color: var(--green); color: var(--green); }
.fb-kinds input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.fb-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.fb-row .primary { margin-left: auto; }
.fb-note { color: var(--muted); font-size: .8rem; }
#fb-list { display: grid; gap: .5rem; }
.fb-item { border: 1px solid var(--line); border-radius: .75rem; padding: .55rem .75rem; }
.fb-item p { margin: .3rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-item-head { display: flex; align-items: center; gap: .5rem; }
.fb-kind, .fb-status { padding: .05rem .45rem; border-radius: 1rem; font-size: .75rem; background: #f0f2f0; }
.kind-bug { background: #fbe9e7; color: #9c3d2e; }
.fb-status.status-open { background: #fdf3e0; color: #8a5a12; }
.fb-status.status-processing { background: #e3ecfa; color: #33527a; }
.fb-status.status-done { background: #dceee4; color: var(--green); }

@media (width >= 900px) {
  :root { --gutter: max(2rem, calc((100% - 68rem) / 2)); }
  main { grid-template-columns: 300px minmax(0, 1fr); }
  #statusbar { padding-inline: var(--gutter); }
  #thread > .bubble { max-width: 75%; }
  #thread > .card { padding: 1rem 1.25rem; }
  textarea { max-height: 40vh; }
  footer { padding-bottom: max(1.25rem, env(safe-area-inset-bottom)); }
  .pill textarea { max-height: min(40vh, calc(100dvh * .4)); padding-inline: .5rem; }
  #compose.mode-task .pill textarea { padding-inline: .75rem .5rem; }
}

.delivery-img { display: block; width: auto; max-width: min(320px, 100%); max-height: 420px; object-fit: contain; margin-top: .5rem; border: 1px solid var(--line); border-radius: .75rem; cursor: zoom-in; background: #f0f2f0; }

.confirm-box { margin-top: .6rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: .75rem; background: #fbfbf8; }
.confirm-box.pending { border-color: #d97706; background: #fff8ec; }
.confirm-box strong { color: #b45309; font-size: .85rem; }
.confirm-box p { margin: .35rem 0 0; }
.confirm-options { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.confirm-options button { border: 1px solid #d97706; background: #fff; color: #92400e; border-radius: 999px; padding: .45rem 1rem; font-weight: 600; cursor: pointer; }
.confirm-options button:hover { background: #fef3c7; }
.confirm-done { color: var(--muted); }
.confirm-badge { background: #fef3c7; color: #92400e; border-radius: 999px; padding: .05rem .45rem; font-weight: 700; }

/* Right-side preview panel (2026-11-20, member feedback: click a link and the
   content presents on the right instead of navigating away) */
#preview-panel { display: flex; flex-direction: column; background: #fff; border-left: 1px solid var(--line); min-width: 0; min-height: 0; }
#preview-panel[hidden] { display: none; }
.pv-head { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; border-bottom: 1px solid var(--line); }
.pv-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-head a { margin-left: auto; flex: none; font-size: .85rem; }
.pv-head button { flex: none; }
#pv-frame { flex: 1; width: 100%; border: 0; min-height: 0; }
.msg-link { color: #6b5ce7; overflow-wrap: anywhere; }
@media (width >= 1100px) {
  main.preview-open { grid-template-columns: 300px minmax(0, 1fr) minmax(0, 46%); }
}

/* Staged files: styled with the composer above (#staged, .staged-chip). */

/* ===== Native-feel interaction pass (2026-11-22) =====
   Goal: make the member page behave like a native app — press feedback,
   sheets, gestures, momentum scrolling — without changing any function. */
* { -webkit-tap-highlight-color: transparent; }
html { overscroll-behavior: none; }
button, a, label, input, select, textarea, .task-row { touch-action: manipulation; }
#thread, #sidebar, #feedback-panel { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
button, .task-row, .card, .fb-item, .file-chip { transition: transform .13s ease, opacity .13s ease, background-color .13s ease; }
button:active, .task-row:active { transform: scale(.97); opacity: .85; }
.confirm-options button:active { transform: scale(.95); }
.file-chip:active { opacity: .65; }
.engine-options label:active, .fb-kinds label:active { transform: scale(.96); }
#submit { transition: transform .13s ease, background-color .2s ease, opacity .2s ease; }
#submit:active { transform: scale(.88); }
textarea:focus, input:focus, select:focus { outline: 2px solid rgb(34 93 72 / .3); outline-offset: 0; border-color: var(--green); }

/* View switching: slide/fade instead of an instant swap */
.view-swap { animation: viewIn .22s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateX(16px); } }
#feedback-panel { animation: fbIn .22s ease-out; }
@keyframes fbIn { from { opacity: 0; transform: translateY(12px); } }
@media (width < 900px) {
  #sidebar { transition: transform .28s cubic-bezier(.32, .9, .35, 1); }
  #scrim { animation: fadeIn .2s ease-out; }
}

/* Loading skeleton for the task/message list */
.skeleton { border: 1px solid var(--line); border-radius: 1rem; background: #fff; padding: .9rem 1rem; }
.skeleton i { display: block; height: .8rem; border-radius: .4rem; margin: .35rem 0; background: linear-gradient(90deg, #e8ede9 25%, #f5f8f5 50%, #e8ede9 75%); background-size: 200% 100%; animation: shimmer 1.15s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Bottom sheet (mobile) / centered dialog (desktop), e.g. identity switch */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: rgb(22 35 30 / 45%); animation: fadeIn .18s ease-out; }
.sheet { width: 100%; max-width: 30rem; background: #fff; border-radius: 1.1rem 1.1rem 0 0; padding: 1rem 1.1rem max(1.1rem, env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgb(0 0 0 / .18); animation: sheetUp .28s cubic-bezier(.32, .9, .35, 1); transition: transform .2s ease; }
.sheet.dragging { transition: none; }
.sheet p { white-space: pre-wrap; margin: .2rem 0 1rem; }
.sheet-actions { display: grid; gap: .55rem; }
.sheet-actions button { min-height: 2.9rem; border-radius: .8rem; font-weight: 600; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes fadeIn { from { opacity: 0; } }
@media (width >= 700px) {
  .sheet-backdrop { align-items: center; padding: 1rem; }
  .sheet { border-radius: 1.1rem; animation: fbIn .2s ease-out; }
}

/* Preview panel: full-screen slide-in page below desktop width */
@media (width < 1100px) {
  #preview-panel { position: fixed; inset: 0; z-index: 15; animation: pvIn .28s cubic-bezier(.32, .9, .35, 1); }
}
@keyframes pvIn { from { transform: translateX(100%); } }
@media (width >= 1100px) {
  #preview-panel { animation: pvFade .2s ease-out; }
  @keyframes pvFade { from { opacity: 0; transform: translateX(18px); } }
}

/* In-page image viewer: tap to close, swipe between images, pinch-friendly */
#lightbox { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgb(10 14 12 / 94%); animation: fadeIn .18s ease-out; }
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; touch-action: pinch-zoom; animation: lbIn .22s ease-out; }
@keyframes lbIn { from { opacity: 0; transform: scale(.97); } }
.lb-count { position: absolute; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%); color: #fff; font-size: .85rem; opacity: .85; }

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

/* Overflow fix found in verification (2026-11-22): the header row and the
   composer textarea have large min-content sizes; without these, narrow
   phones get a page wider than the screen (feedback button pushed out). */
header, footer, #thread, #statusbar { min-width: 0; }
.whoami { flex: 0 1 auto; }
textarea { min-width: 0; }

/* Direct-to-hub button + sheet (2026-11-22) */
.direct-open { flex: none; font-weight: 600; color: #6b5ce7; border: 1px solid #6b5ce7; background: #fff; border-radius: 999px; padding: .35rem .7rem; }
.sheet textarea.direct-text { width: 100%; box-sizing: border-box; border: 1px solid #d8d8de; border-radius: .7rem; padding: .6rem .7rem; font: inherit; margin-bottom: .8rem; resize: vertical; }

/* Identity badge on its own line (2026-11-22): never ellipsize 当前身份. */
header { flex-wrap: wrap; }
.whoami { order: 9; flex: 1 1 100%; min-width: 0; overflow: visible; text-overflow: clip; white-space: normal; margin-left: 0; text-align: left; }
