/* Kiro 写稿台 — warm paper, soft embossed surfaces, muted semantic colours.
   Lane colours: daily = mist, longform = ochre, interaction = clay, radar = sage, chrome = mauve. */

:root {
  --paper: #f2f0eb;
  --paper-deep: #e9e6df;
  --surface: rgba(255, 255, 255, 0.34);
  --surface-strong: rgba(255, 255, 255, 0.58);
  --ink: #26251f;
  --ink-soft: #57554e;
  --muted: #8a877f;
  --line: rgba(181, 177, 166, 0.46);
  --line-soft: rgba(171, 167, 157, 0.26);

  --sage: #718277;   --sage-wash: rgba(113, 130, 119, 0.12);
  --mist: #6f8195;   --mist-wash: rgba(111, 129, 149, 0.12);
  --clay: #9b746c;   --clay-wash: rgba(155, 116, 108, 0.12);
  --ochre: #9b835f;  --ochre-wash: rgba(155, 131, 95, 0.13);
  --mauve: #7f748b;  --mauve-wash: rgba(127, 116, 139, 0.12);

  --emboss: 8px 8px 20px rgba(119, 115, 104, 0.12), -7px -7px 18px rgba(255, 255, 255, 0.72);
  --emboss-sm: 4px 4px 10px rgba(119, 115, 104, 0.1), -4px -4px 10px rgba(255, 255, 255, 0.7);
  --inset: inset 2px 2px 5px rgba(122, 117, 106, 0.1), inset -2px -2px 5px rgba(255, 255, 255, 0.7);
  --highlight: inset 1px 1px 0 rgba(255, 255, 255, 0.6);

  /* Latin first so English and digits get a real serif; Windows' bundled FangSong sets them like a typewriter */
  --serif: Georgia, "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --title: Georgia, "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  --gap: clamp(1rem, 0.6rem + 1.2vw, 1.8rem);
  --radius: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar: 236px;
  --rail: 176px;
  --railh: 62px;
  --panel: 410px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 15px/1.8 var(--sans);
  background-color: var(--paper);
  /* fibre-like grain in place of a texture image */
  background-image:
    radial-gradient(ellipse at 15% 0%, rgba(255, 255, 255, 0.55), transparent 55%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.43 0 0 0 0 0.39 0 0 0 0.09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; color: inherit; }
a { color: var(--ink-soft); text-decoration: underline; text-decoration-color: #aaa69d; text-underline-offset: 4px; }
a:hover { color: var(--mist); text-decoration-color: var(--mist); }

/* ── shared pieces ─────────────────────────────────────────── */
.monogram {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--emboss-sm), var(--highlight);
  font: 400 1.5rem/1 var(--title);
  color: var(--mauve);
}
.monogram--sm { width: 32px; height: 32px; font-size: 0.95rem; box-shadow: var(--emboss-sm); }
.ornament { display: block; color: var(--muted); font-size: 0.85rem; margin-bottom: 0.6rem; }
.label { margin: 0; font: 500 0.78rem/1 var(--sans); letter-spacing: 0.32em; color: var(--muted); }
.form-error { margin: 0.5rem 0 0; color: var(--clay); font-size: 0.85rem; }
.form-error:empty { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--emboss-sm), var(--highlight);
  font: 500 0.86rem/1.2 var(--sans);
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  cursor: pointer;
  transition: box-shadow 200ms var(--ease), color 200ms, transform 120ms;
}
.btn:hover { color: var(--ink); box-shadow: var(--emboss), var(--highlight); }
.btn:active { box-shadow: var(--inset); transform: translateY(1px); }
.btn--ink { background: var(--mist); border-color: var(--mist); color: #fbfaf7; box-shadow: var(--emboss-sm); }
.btn--ink:hover { color: #fff; background: #63748a; }
.btn--line { background: transparent; box-shadow: none; }
.btn--line:hover { background: var(--surface); box-shadow: var(--emboss-sm); }
.btn--small { padding: 0.28rem 0.85rem; font-size: 0.78rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: progress; }
.link { background: none; border: none; padding: 0; color: var(--muted); font: 0.82rem/1.4 var(--sans); letter-spacing: 0.06em; cursor: pointer; }
.link:hover { color: var(--mauve); }
:is(.btn, .link, .quick__item, .tab, .send, .icon-btn, .session__open, .updated__chip):focus-visible { outline: 2px solid var(--mist); outline-offset: 3px; }

/* ── login ─────────────────────────────────────────────────── */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.invite {
  width: min(380px, 100%);
  padding: 3rem 2.4rem 2.4rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--emboss), var(--highlight);
  display: grid;
  justify-items: center;
  gap: 0.9rem;
}
.invite__title { margin: 0.8rem 0 0; font: 400 2rem/1.3 var(--title); letter-spacing: 0.08em; }
.invite__line { margin: 0 0 1rem; font: 400 0.85rem/1.6 var(--sans); letter-spacing: 0.08em; color: var(--muted); }
.field-line {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: var(--inset);
  font: 400 1rem/1.4 var(--sans);
  text-align: center;
  letter-spacing: 0.12em;
  color: var(--ink);
}
.field-line:focus { outline: none; border-color: var(--mist); }

/* ── three-column app ──────────────────────────────────────── */
/* ── shell: the page menu on the left, one page at a time ───── */
.shell { height: 100vh; height: 100dvh; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); }
.rail { display: flex; flex-direction: column; min-height: 0; padding: 1.5rem 0.8rem 1.1rem; border-right: 1px solid var(--line-soft); }
.rail__brand { display: flex; align-items: center; gap: 0.7rem; padding: 0 0.4rem 1.7rem; font: 400 0.95rem/1 var(--title); letter-spacing: 0.4em; color: var(--ink-soft); }
.menu { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.menu__item { display: flex; align-items: center; gap: 0.7rem; width: 100%; padding: 0.72rem 0.8rem; border: 1px solid transparent; border-radius: 14px; background: none; text-align: left; cursor: pointer; color: var(--ink-soft); font: 400 0.98rem/1.3 var(--title); transition: background 150ms; }
.menu__item i { font-style: normal; width: 1.3rem; text-align: center; color: var(--muted); }
.menu__item:hover { background: var(--surface); }
.menu__item.is-active { background: var(--surface-strong); border-color: var(--line); box-shadow: var(--emboss-sm), var(--highlight); color: var(--ink); }
.menu__item.is-active i { color: var(--mist); }
.menu__item:focus-visible { outline: 2px solid var(--mist); outline-offset: 2px; }
.rail__foot { margin-top: auto; padding: 1rem 0.5rem 0; border-top: 1px solid var(--line-soft); font-size: 0.8rem; }
.page { min-width: 0; min-height: 0; overflow-y: auto; padding: 2rem clamp(1.2rem, 3vw, 3.2rem) 3rem; }
.page--write { padding: 0; overflow: hidden; }
.today, .wide { max-width: 1180px; }
.ph { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; margin-bottom: 1.6rem; }
.ph h1 { margin: 0; font: 400 clamp(1.7rem, 1.2rem + 1.2vw, 2.3rem)/1.2 var(--title); letter-spacing: 0.04em; }
.ph p { margin: 0.4rem 0 0; font-size: 0.85rem; color: var(--muted); }
.ph__side { margin-left: auto; }
.note { margin: 0.8rem 0 0; padding: 0.6rem 0.9rem; border-radius: 10px; background: var(--ochre-wash); font-size: 0.84rem; color: var(--ink-soft); }

/* 写稿 page: conversations | chat | drafts */
.write {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr) 14px var(--panel);
}

/* divider between chat and drafts: drag to resize */
.resizer { position: relative; cursor: col-resize; touch-action: none; }
.resizer::before {
  content: ""; position: absolute; top: 12%; bottom: 12%; left: 50%; width: 1px; translate: -50% 0;
  background: transparent; transition: background 150ms, width 150ms;
}
.resizer::after {
  content: ""; position: absolute; top: 50%; left: 50%; translate: -50% -50%;
  width: 4px; height: 36px; border-radius: 999px; background: var(--line); transition: background 150ms;
}
.resizer:hover::before, .resizer:focus-visible::before, .is-resizing .resizer::before { background: var(--mist); width: 2px; }
.resizer:hover::after, .resizer:focus-visible::after, .is-resizing .resizer::after { background: var(--mist); }
.resizer:focus-visible { outline: none; }
.is-resizing, .is-resizing * { cursor: col-resize !important; user-select: none; }

/* sessions */
.sessions { display: flex; flex-direction: column; gap: 1.2rem; padding: 1.6rem 1.1rem 1.1rem; min-height: 0; }
.sessions__head { display: flex; align-items: center; gap: 0.75rem; padding: 0 0.3rem; }
.sessions__brand { font: 400 1.05rem/1 var(--title); letter-spacing: 0.22em; color: var(--ink); }
.sessions__list { list-style: none; margin: 0; padding: 0.2rem; overflow-y: auto; flex: 1; min-height: 0; display: grid; gap: 0.35rem; align-content: start; }
.session { position: relative; }
.session__open {
  display: block;
  width: 100%;
  padding: 0.6rem 2rem 0.6rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 14px;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background 200ms, box-shadow 200ms;
}
.session__open:hover { background: rgba(255, 255, 255, 0.25); }
.session.is-current .session__open { background: var(--surface); border-color: var(--line); box-shadow: var(--emboss-sm), var(--highlight); }
.session__title { display: block; font: 400 0.92rem/1.5 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session__time { display: block; font: 0.72rem/1.4 var(--sans); color: var(--muted); }
.session__delete {
  position: absolute; right: 0.5rem; top: 50%; translate: 0 -50%;
  border: none; background: none; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity 150ms;
}
.session:hover .session__delete, .session__delete:focus-visible { opacity: 1; }
.session__delete:hover { color: var(--clay); }
.sessions__foot { display: flex; gap: 0.6rem; justify-content: center; color: var(--muted); padding-top: 0.8rem; border-top: 1px solid var(--line-soft); }

/* chat */
.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 0.8rem 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: var(--emboss), var(--highlight);
}
.topbar { display: flex; align-items: center; gap: 1rem; padding: 1rem var(--gap); border-bottom: 1px solid var(--line-soft); }
.topbar__title { margin: 0; flex: 1; font: 400 1.08rem/1.4 var(--title); letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { display: none; border: none; background: none; font-size: 1.1rem; cursor: pointer; padding: 0.2rem 0.4rem; color: var(--ink-soft); }
.tabs { display: none; }

.thread { flex: 1; overflow-y: auto; padding: calc(var(--gap) * 1.4) var(--gap); scroll-behavior: smooth; }
.thread > * { max-width: 740px; margin-inline: auto; }
.welcome { text-align: center; padding: 13vh 1rem 2rem; }
.welcome__title { margin: 0 0 0.7rem; font: 400 1.9rem/1.4 var(--title); letter-spacing: 0.04em; }
.welcome__hint { margin: 0; color: var(--muted); font: 400 0.95rem/1.9 var(--serif); }

.msg { margin-bottom: 1.9rem; animation: rise 450ms var(--ease) both; }
.msg--user { display: flex; justify-content: flex-end; }
.msg--user .msg__body {
  max-width: 80%;
  padding: 0.7rem 1.15rem;
  border: 1px solid rgba(111, 129, 149, 0.22);
  border-radius: 18px 18px 6px 18px;
  background: var(--mist-wash);
  font: 400 0.98rem/1.8 var(--serif);
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg--assistant { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 0.9rem; }
.msg--assistant > .msg__body {
  padding: 1.1rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: 6px 18px 18px 18px;
  background: var(--surface);
  box-shadow: var(--emboss-sm), var(--highlight);
}
.msg--error > .msg__body { color: var(--clay); border-left: 3px solid var(--clay); }

.md { font: 400 1rem/1.95 var(--serif); letter-spacing: 0.01em; overflow-wrap: anywhere; }
.md p { margin: 0 0 0.85rem; }
.md h4 { margin: 1.2rem 0 0.4rem; font: 600 0.8rem/1.4 var(--sans); letter-spacing: 0.12em; color: var(--mauve); }
.md ul, .md ol { margin: 0 0 0.85rem; padding-left: 1.3rem; }
.md li { margin-bottom: 0.25rem; }
.md li::marker { color: var(--muted); }
.md strong { font-weight: 700; background: linear-gradient(transparent 60%, rgba(178, 162, 116, 0.22) 60%, rgba(178, 162, 116, 0.22) 92%, transparent 92%); }
.md code { font: 0.85em var(--mono); padding: 0.05em 0.4em; border: 1px solid rgba(111, 129, 149, 0.25); border-radius: 5px; background: var(--mist-wash); }
.md > :last-child { margin-bottom: 0; }

.updated { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.updated__chip {
  border: 1px solid rgba(111, 129, 149, 0.25); border-radius: 999px; background: var(--mist-wash); cursor: pointer;
  padding: 0.18rem 0.8rem; font: 500 0.78rem/1.5 var(--sans); letter-spacing: 0.04em; color: #5b6f84;
}
.updated__chip::before { content: "↗ "; }
.updated__chip:hover { background: rgba(111, 129, 149, 0.2); }

/* progress, shown as the assistant's pending turn */
.msg__body.pending { font-size: 0.85rem; color: var(--ink-soft); border-left: 3px solid var(--mist); }
.pending__head { display: flex; justify-content: space-between; margin: 0 0 0.4rem; font: 600 0.8rem/1.4 var(--sans); letter-spacing: 0.12em; color: var(--mist); }
.pending__head span:first-child::after { content: " …"; animation: breathe 1.4s ease-in-out infinite; }
.pending ol { list-style: none; margin: 0; padding: 0; font-family: var(--serif); font-size: 0.92rem; }
.pending li::before { content: "· "; color: var(--muted); }
.pending li.is-warn { color: var(--clay); }
.pending__lanes { margin-top: 0.4rem; font: 0.76rem/1.7 var(--mono); }
.pending__lanes p { margin: 0; }
.mark-ok { color: var(--sage); }
.mark-no { color: var(--clay); }

/* topic radar cards inside a reply */
.topics { list-style: none; margin: 1.3rem 0 0; padding: 0; display: grid; gap: 0.9rem; }
.topic {
  --tone: var(--sage); --tone-wash: var(--sage-wash);
  position: relative;
  padding: 1.15rem 1.2rem 1rem 4rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tone);
  border-radius: 6px 16px 16px 6px;
  background: rgba(255, 255, 255, 0.4);
}
.topic:nth-child(5n + 2) { --tone: var(--mist); --tone-wash: var(--mist-wash); }
.topic:nth-child(5n + 3) { --tone: var(--mauve); --tone-wash: var(--mauve-wash); }
.topic:nth-child(5n + 4) { --tone: var(--ochre); --tone-wash: var(--ochre-wash); }
.topic:nth-child(5n + 5) { --tone: var(--clay); --tone-wash: var(--clay-wash); }
.topic__no {
  position: absolute; left: 1rem; top: 1.05rem;
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--tone); background: var(--tone-wash); color: var(--tone);
  font: 400 0.95rem/1 var(--title);
}
.topic__title { margin: 0 0 0.45rem; font: 400 1.08rem/1.6 var(--title); }
.topic__tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.65rem; }
.topic__tag { font: 600 0.7rem/1.5 var(--sans); padding: 0.08rem 0.55rem; border-radius: 999px; border: 1px solid var(--line-soft); background: var(--tone-wash); color: var(--tone); }
.topic__facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.2rem 0.9rem; margin: 0 0 0.6rem; font: 400 0.92rem/1.8 var(--serif); }
.topic__facts dt { font: 500 0.78rem/2.1 var(--sans); color: var(--muted); }
.topic__facts dd { margin: 0; }
.topic__sources, .topic__gaps { margin: 0 0 0.55rem; padding-left: 1.1rem; font-size: 0.82rem; color: var(--ink-soft); }
.topic__gaps { color: var(--clay); }
.topic__foot { display: flex; justify-content: flex-end; }
.watch { margin-top: 1.1rem; font-size: 0.85rem; color: var(--ink-soft); }
.watch summary { cursor: pointer; color: var(--muted); font-family: var(--sans); }

/* composer */
.composer { padding: 0.5rem var(--gap) calc(0.9rem + env(safe-area-inset-bottom)); }
.composer > * { max-width: 740px; margin-inline: auto; }
.quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; margin-bottom: 0.7rem; }
.quick__item {
  border: 1px solid var(--line-soft); border-radius: 999px; background: var(--surface);
  padding: 0.22rem 0.85rem; font: 500 0.8rem/1.5 var(--sans); letter-spacing: 0.04em; color: var(--ink-soft);
  box-shadow: var(--emboss-sm); cursor: pointer; transition: color 150ms, box-shadow 150ms;
}
.quick__item:nth-child(1) { color: var(--sage); }
.quick__item:nth-child(2) { color: var(--mist); }
.quick__item:nth-child(3) { color: var(--ochre); }
.quick__item:nth-child(4), .quick__item:nth-child(5) { color: var(--clay); }
.quick__item:hover { box-shadow: var(--emboss); }
.quick__item:active { box-shadow: var(--inset); }
.composer__box {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  padding: 0.5rem 0.5rem 0.5rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: var(--inset);
  transition: border-color 200ms;
}
.composer__box:focus-within { border-color: rgba(111, 129, 149, 0.55); }
.composer textarea {
  flex: 1;
  max-height: 40vh;
  padding: 0.45rem 0;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font: 400 1rem/1.7 var(--serif);
  color: var(--ink);
}
.send { flex: none; width: 38px; height: 38px; border: none; border-radius: 50%; background: var(--mist); color: #fbfaf7; font-size: 1.05rem; cursor: pointer; box-shadow: var(--emboss-sm); }
.send:hover { background: #63748a; }
.send:disabled { background: var(--paper-deep); color: var(--muted); cursor: progress; box-shadow: var(--inset); }

/* drafts panel */
.drafts { display: flex; flex-direction: column; min-height: 0; }
.drafts__head { padding: 1.7rem var(--gap) 0.9rem; }
.drafts__head .label { padding-left: 0.8rem; border-left: 3px solid var(--mauve); line-height: 1.6; }
.drafts__source { margin: 0.4rem 0 0 1rem; font: 0.72rem/1.4 var(--mono); color: var(--muted); }
.drafts__list { flex: 1; overflow-y: auto; padding: 0.4rem var(--gap) var(--gap); display: grid; gap: 1.1rem; align-content: start; }
.empty { text-align: center; color: var(--muted); font: 400 0.95rem/1.6 var(--serif); padding: 12vh 0; }

.proof {
  --lane: var(--mist); --lane-wash: var(--mist-wash);
  position: relative;
  padding: 1.25rem 1.25rem 1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--lane);
  border-radius: 6px var(--radius) var(--radius) 6px;
  background: var(--surface);
  box-shadow: var(--emboss), var(--highlight);
  animation: rise 450ms var(--ease) both;
}
.proof--longform { --lane: var(--ochre); --lane-wash: var(--ochre-wash); }
.proof--interaction { --lane: var(--clay); --lane-wash: var(--clay-wash); }
.proof.is-flash { animation: flash 1.4s var(--ease); }
.proof__lane { display: inline-block; padding: 0.12rem 0.7rem; border-radius: 999px; background: var(--lane-wash); border: 1px solid var(--line-soft); font: 600 0.74rem/1.5 var(--sans); letter-spacing: 0.08em; color: var(--lane); }
.proof__title { margin: 0.6rem 3.4rem 0.8rem 0; font: 400 0.82rem/1.6 var(--sans); color: var(--muted); }
.proof__format { display: inline-block; margin: 0.9rem 0 0.4rem; font: 600 0.72rem/1.4 var(--sans); letter-spacing: 0.1em; color: var(--lane); }
.proof__body { margin: 0; font: 400 0.98rem/1.95 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
.proof--longform .proof__body { max-height: 26rem; overflow-y: auto; padding-right: 0.4rem; }

.seal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: var(--sage-wash);
  font: 600 0.72rem/1.1 var(--sans);
  letter-spacing: 0.08em;
  color: var(--sage);
  transform: rotate(-10deg);
}
.seal--no { color: var(--clay); background: var(--clay-wash); }

.source { position: relative; margin: 0 0 0.9rem; padding: 0.7rem 0.9rem 0.7rem 2.2rem; border-radius: 4px 12px 12px 4px; border-left: 3px solid #aaa79d; background: rgba(255, 255, 255, 0.3); box-shadow: var(--inset); font-size: 0.8rem; color: var(--ink-soft); }
.source::before { content: "“"; position: absolute; left: 0.6rem; top: -0.1rem; font: 400 1.9rem/1 Georgia, serif; color: #aaa69d; }
.source p { margin: 0; }

.proof__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.9rem; padding-top: 0.75rem; border-top: 1px dashed var(--line); }
.meter { display: inline-flex; align-items: center; gap: 0.5rem; margin-right: auto; font: 0.74rem/1 var(--mono); color: var(--ink-soft); }
.meter__track { width: 64px; height: 6px; border-radius: 999px; background: rgba(153, 149, 139, 0.15); box-shadow: inset 1px 1px 3px rgba(117, 112, 101, 0.14); position: relative; overflow: hidden; }
.meter__track::after { content: ""; position: absolute; inset: 0; width: calc(var(--fill, 0) * 100%); border-radius: inherit; background: var(--sage); }
.meter.is-over { color: var(--clay); }
.meter.is-over .meter__track::after { background: var(--clay); }

.notes { position: relative; margin-top: 1.1rem; padding: 1rem 0.9rem 0.6rem; border-radius: 12px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.28); font-size: 0.82rem; color: var(--ink-soft); }
.notes summary { position: absolute; top: -0.7rem; left: 0.8rem; padding: 0.05rem 0.6rem; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font: 600 0.7rem/1.5 var(--sans); color: var(--muted); cursor: pointer; list-style: none; }
.notes summary::-webkit-details-marker { display: none; }
.notes:not([open]) { padding: 0; border: none; background: none; }
.notes:not([open]) summary { position: static; display: inline-block; }
.notes h4 { margin: 0.5rem 0 0.15rem; font: 600 0.72rem/1.4 var(--sans); letter-spacing: 0.08em; color: var(--lane, var(--mauve)); }
.notes ul { margin: 0; padding-left: 1.1rem; }
.revise { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.revise input { flex: 1; min-width: 0; padding: 0.45rem 0.8rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.4); box-shadow: var(--inset); font: 400 0.9rem/1.4 var(--serif); color: var(--ink); }
.revise input:focus { outline: none; border-color: var(--mist); }

/* right-panel switch + publish tracking */
.panel-tabs { display: inline-flex; gap: 0.2rem; padding: 3px; border-radius: 999px; border: 1px solid var(--line); box-shadow: var(--inset); }
.panel-tab { border: none; background: none; border-radius: 999px; padding: 0.22rem 0.95rem; font: 500 0.8rem/1.5 var(--sans); letter-spacing: 0.06em; color: var(--muted); cursor: pointer; }
.panel-tab.is-active { background: var(--surface-strong); color: var(--ink); box-shadow: var(--emboss-sm); }
.panel-tab:focus-visible { outline: 2px solid var(--mist); outline-offset: 2px; }
.drafts__source { margin-left: 0.2rem; }
.tracker { flex: 1; min-height: 0; overflow-y: auto; padding: 0.2rem var(--gap) var(--gap); }
.tracker__bar { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; }
.tracker__status { margin: 0.7rem 0 1rem; font-size: 0.8rem; color: var(--muted); }
.tracker__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.track {
  --lane: var(--mist); --lane-wash: var(--mist-wash);
  padding: 1rem 1.1rem 0.9rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--lane);
  border-radius: 6px 16px 16px 6px;
  background: var(--surface);
  box-shadow: var(--emboss-sm), var(--highlight);
}
.track--longform { --lane: var(--ochre); --lane-wash: var(--ochre-wash); }
.track--interaction { --lane: var(--clay); --lane-wash: var(--clay-wash); }
.track.is-dismissed { opacity: 0.55; }
.track__head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.track__time { font: 0.72rem/1.4 var(--sans); color: var(--muted); }
.track__title { margin: 0.55rem 0 0.2rem; font: 400 0.98rem/1.6 var(--title); }
.track__preview { margin: 0 0 0.7rem; font: 400 0.82rem/1.7 var(--serif); color: var(--ink-soft); }
.stepper { list-style: none; margin: 0 0 0.55rem; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); font: 500 0.7rem/1.4 var(--sans); color: var(--muted); }
.stepper li { position: relative; padding-top: 0.95rem; text-align: center; }
.stepper li::before {
  content: ""; position: absolute; top: 0.15rem; left: 50%; translate: -50% 0; z-index: 1;
  width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper);
}
.stepper li + li::after { content: ""; position: absolute; top: 0.43rem; right: 50%; width: 100%; height: 1px; background: var(--line); }
.stepper li.is-done { color: var(--lane); }
.stepper li.is-done::before { background: var(--lane); border-color: var(--lane); }
.stepper li.is-done + li.is-done::after { background: var(--lane); }
.track__metrics { margin: 0 0 0.5rem; font: 400 0.82rem/1.6 var(--mono); color: var(--ink-soft); }
.track__metrics--empty { font-family: var(--sans); color: var(--muted); }
.track__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.82rem; }
.track__hint { font-size: 0.72rem; color: var(--muted); }

/* structure library */
.structures { flex: 1; min-height: 0; overflow-y: auto; padding: 0.2rem var(--gap) var(--gap); display: grid; gap: 1.4rem; align-content: start; }
.lib { padding: 1.1rem 1.15rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--emboss-sm), var(--highlight); }
.lib__head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.lib__head h3 { margin: 0; padding-left: 0.7rem; border-left: 3px solid var(--sage); font: 400 1.02rem/1.4 var(--title); }
.lib__count { margin-left: 0.3rem; font: 500 0.78rem/1 var(--sans); color: var(--muted); }
.lib__meta { margin: 0.45rem 0 0; font-size: 0.78rem; color: var(--muted); }
.lib__actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.7rem; }
.lib__list { list-style: none; margin: 0.8rem 0 0; padding: 0; display: grid; gap: 0.8rem; }
.lib .notes { margin-top: 1.1rem; }
.playbook { margin-top: 0.8rem; max-height: 28rem; overflow-y: auto; padding-right: 0.3rem; }
.playbook .md { font-size: 0.92rem; line-height: 1.85; }
.playbook-form { display: grid; gap: 0.6rem; margin-top: 0.8rem; }
.playbook-form textarea, .structure-form textarea, .structure-form input:not([type="checkbox"]), .playbook-form input {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.45); box-shadow: var(--inset); font: 400 0.88rem/1.7 var(--serif); color: var(--ink); resize: vertical;
}
.playbook-form textarea { font-family: var(--mono); font-size: 0.8rem; }
.structure {
  padding: 0.9rem 1rem; border: 1px solid var(--line-soft); border-left: 3px solid var(--sage); border-radius: 6px 14px 14px 6px;
  background: rgba(255, 255, 255, 0.35);
}
.structure.is-candidate { border-left-color: var(--ochre); }
.structure.is-disabled { opacity: 0.55; }
.structure.is-flash { --lane-wash: rgba(113, 130, 119, 0.35); animation: flash 1.4s var(--ease); }
.structure__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem; }
.structure__head h4 { margin: 0 0.3rem 0 0; font: 400 0.98rem/1.5 var(--title); }
summary.structure__head { cursor: pointer; list-style: none; }
summary.structure__head::-webkit-details-marker { display: none; }
summary.structure__head::after { content: "展开"; margin-left: auto; font: 500 0.72rem/1.5 var(--sans); color: var(--muted); }
.structure__fold[open] > summary.structure__head::after { content: "收起"; }
summary.structure__head:focus-visible { outline: 2px solid var(--sage); outline-offset: 4px; border-radius: 4px; }
.lib__filter { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.6rem 0 0.2rem; }
.filter { padding: 0.15rem 0.7rem; border: 1px solid var(--line-soft); border-radius: 999px; background: transparent; font: 500 0.74rem/1.6 var(--sans); color: var(--muted); cursor: pointer; }
.filter:hover { color: var(--ink-soft); border-color: var(--line); }
.filter.is-active { color: var(--paper, #f2f0eb); background: var(--sage); border-color: var(--sage); }
.chip { font: 600 0.68rem/1.5 var(--sans); padding: 0.05rem 0.5rem; border-radius: 999px; border: 1px solid var(--line-soft); }
.chip--daily { color: var(--mist); background: var(--mist-wash); }
.chip--longform { color: var(--ochre); background: var(--ochre-wash); }
.chip--interaction { color: var(--clay); background: var(--clay-wash); }
.structure__facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.15rem 0.8rem; margin: 0.6rem 0 0; font: 400 0.86rem/1.75 var(--serif); }
.structure__facts dt { font: 500 0.74rem/2 var(--sans); color: var(--muted); }
.structure__facts dd { margin: 0; }
.lib__evidence { margin: 0.5rem 0 0; padding-left: 1.1rem; font-size: 0.76rem; color: var(--ink-soft); }
.structure-form { display: grid; gap: 0.4rem; margin-top: 0.7rem; }
.structure-form label { font: 500 0.74rem/1.4 var(--sans); color: var(--muted); }
.structure-form__lanes { display: flex; gap: 0.8rem; font-size: 0.82rem; color: var(--ink-soft); }
.structure-form__lanes label { font-size: 0.82rem; color: var(--ink-soft); }
.accounts { list-style: none; margin: 0.8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.account { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.3rem 0.2rem 0.75rem; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.4); font-size: 0.82rem; }
.account--manual { border-color: rgba(113, 130, 119, 0.45); background: var(--sage-wash); }
.account__role { font-size: 0.7rem; color: var(--muted); }
.account__remove { border: none; background: none; color: var(--muted); cursor: pointer; padding: 0 0.3rem; }
.account__remove:hover { color: var(--clay); }
#account-form select { border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.45); padding: 0 0.5rem; font: inherit; font-size: 0.85rem; color: var(--ink-soft); }
.proof__structure { margin: -0.4rem 3.4rem 0.8rem 0; font: 500 0.74rem/1.5 var(--sans); color: var(--sage); }

/* archive dialog */
.archive { width: min(520px, calc(100vw - 2rem)); max-height: 80vh; padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--emboss); color: var(--ink); }
.archive::backdrop { background: rgba(38, 37, 31, 0.3); }
.archive__head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line-soft); }
.archive__head h2 { margin: 0; font: 400 1.05rem/1 var(--title); letter-spacing: 0.1em; }
.archive__hint { margin: 0.8rem 1.4rem 0; font-size: 0.8rem; color: var(--muted); }
.archive__list { list-style: none; margin: 0; padding: 0.6rem; overflow-y: auto; max-height: 60vh; }
.archive__list button { display: grid; width: 100%; padding: 0.65rem 0.9rem; border: none; border-radius: 12px; background: none; text-align: left; font-family: var(--serif); cursor: pointer; }
.archive__list button:hover { background: var(--surface); }
.archive__list time { font: 0.72rem var(--mono); color: var(--muted); }

/* motion */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes breathe { 50% { opacity: 0.25; } }
@keyframes flash { 0%, 100% { box-shadow: var(--emboss), var(--highlight); } 30% { box-shadow: 0 0 0 6px var(--lane-wash), var(--emboss); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ── narrower screens: drafts panel becomes a tab, sessions a drawer ─ */
@media (max-width: 1180px) {
  :root { --panel: 350px; --sidebar: 224px; }
}
@media (max-width: 960px) {
  .write { grid-template-columns: minmax(0, 1fr); }
  .resizer { display: none; }
  .chat { margin: 0; border: none; border-radius: 0; box-shadow: none; background: transparent; }
  .sessions {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 84vw); z-index: 20;
    background-color: var(--paper); box-shadow: var(--emboss);
    transform: translateX(-105%); transition: transform 300ms var(--ease);
  }
  .write.is-menu-open .sessions { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 10; background: rgba(38, 37, 31, 0.25); }
  .icon-btn { display: block; }
  .tabs { display: flex; gap: 0.2rem; padding: 3px; border-radius: 999px; border: 1px solid var(--line); box-shadow: var(--inset); }
  .tab { border: none; background: none; border-radius: 999px; padding: 0.2rem 0.6rem; font: 500 0.8rem/1.5 var(--sans); cursor: pointer; color: var(--muted); }
  .tab.is-active { background: var(--surface-strong); color: var(--ink); box-shadow: var(--emboss-sm); }
  .tab__count:empty { display: none; }
  .drafts { display: none; }
  /* phones: 对话 / 稿件 are two tabs under the same top bar */
  .write { display: flex; flex-direction: column; }
  .chat { flex: 1; min-height: 0; }
  .write.is-drafts .chat { flex: none; }
  .write.is-drafts :is(.thread, .composer) { display: none; }
  .write.is-drafts .drafts { display: flex; flex: 1; min-height: 0; }
  .quick { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding-bottom: 0.3rem; scrollbar-width: none; }
  .quick__item { flex: none; }
  .msg--user .msg__body { max-width: 88%; }
  .msg--assistant { grid-template-columns: 1fr; }
  .msg--assistant > .monogram { display: none; }
  .topic { padding: 1rem 0.95rem 0.9rem 3.4rem; }
  .topic__no { left: 0.75rem; width: 32px; height: 32px; }
  .topic__facts { grid-template-columns: 1fr; }
  .topic__facts dt { line-height: 1.6; }
}
