:root {
  --paper: #f5f6f2;
  --surface: #fff;
  --ink: #22271f;
  --muted: #687062;
  --line: #e4e8df;
  --accent: #d2ed91;
  --rail: #f0f2eb;
  --subsurface: #fafbf8;
  --soft: #f1f4e9;
  --hover: #edf0e7;
  --action: #22271f;
  --action-text: #fff;
  --accent-ink: #22271f;
  --error: #a33b3b;
  --link: #526449;
  --focus: #658635;
  --assistant-bubble: #f1f4ec;
  --user-bubble: #e3edcf;
  color-scheme: light;
  --body-size: 18px;
  --body-leading: 1.7;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea {
  outline-offset: 4px;
}
button {
  cursor: pointer;
  color: inherit;
}
button {
  border: 0;
  background: none;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
}
button[aria-busy="true"] {
  cursor: progress;
}
input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  background: var(--surface);
  color: var(--ink);
}
textarea {
  resize: vertical;
  line-height: var(--body-leading);
  font-size: var(--body-size);
}
p,
.reading {
  font-size: var(--body-size);
  line-height: var(--body-leading);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -1.5px;
}
h2 {
  font-size: 25px;
  font-weight: 550;
}
h3 {
  font-size: 19px;
}
small,
.meta {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.initial {
  display: grid;
  place-items: center;
  height: 100dvh;
  font-size: 18px;
}
.primary {
  background: var(--action);
  color: var(--action-text);
  border-radius: 12px;
  padding: 12px 20px;
  min-height: 48px;
}
.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 16px;
  min-height: 44px;
}
.danger {
  color: var(--error);
}
.error {
  color: var(--error);
  font-size: 18px;
  line-height: 1.7;
}
.field-error {
  display: block;
  color: var(--error);
  font-size: 16px;
  line-height: 1.7;
}
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 260px;
  padding: 40px;
  text-align: center;
}
.empty p {
  max-width: 480px;
  color: var(--muted);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.8px;
}
.brand img {
  width: 38px;
  height: 38px;
}
.login {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1300px;
  margin: auto;
  padding: 70px;
  align-items: center;
  gap: 100px;
}
.login-story {
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.login-story h1 {
  font-size: 52px;
  line-height: 1.3;
}
.login-story .sub {
  color: var(--muted);
  max-width: 420px;
}
.login-art {
  display: grid;
  grid-template-columns: repeat(3, 70px);
  gap: 12px;
  padding: 20px 0;
}
.login-art span {
  width: 70px;
  height: 70px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 24px;
}
.login-art span:nth-child(2) {
  background: var(--accent);
  transform: translateY(-15px);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 36px;
  border-radius: 26px;
  box-shadow: 0 18px 60px #27311a06;
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 28px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 18px;
  line-height: 1.7;
}
.login-card .primary {
  margin-top: 8px;
}
.demo {
  border-top: 1px solid var(--line);
  margin-top: 25px;
  padding-top: 20px;
}
.demo summary {
  cursor: pointer;
  line-height: 1.7;
}
.demo-list {
  display: grid;
  gap: 7px;
  margin-top: 15px;
}
.demo-account {
  text-align: left;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.demo-account span {
  display: block;
  font-size: 13px;
  color: var(--muted);
}
.shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 80px 290px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}
.rail {
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 24px 8px;
  gap: 13px;
  background: var(--rail);
}
.rail img {
  width: 42px;
  height: 42px;
  margin-bottom: 26px;
}
.rail button {
  width: 62px;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 14px;
  font-size: 12px;
  color: var(--muted);
}
.rail button span {
  font-size: 21px;
  line-height: 1.2;
}
.rail button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px #00000004;
}
.rail .bottom {
  margin-top: auto;
}
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--subsurface);
}
.enterprise {
  padding: 28px 22px 18px;
}
.enterprise h2 {
  font-size: 20px;
  margin: 10px 0 6px;
}
.enterprise .kicker {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
}
.side-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 18px 18px;
}
.side-action .primary {
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  text-align: left;
}
.side-action b {
  float: right;
  font-size: 20px;
}
.history {
  padding: 0 10px;
  overflow: auto;
  flex: 1;
}
.history-label {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
}
.history button {
  display: block;
  width: 100%;
  padding: 13px 12px;
  text-align: left;
  border-radius: 12px;
  line-height: 1.6;
}
.history button.active {
  background: var(--soft);
}
.history button:hover,
.history button:focus-visible {
  background: var(--hover);
}
.history button.active:hover,
.history button.active:focus-visible {
  background: color-mix(in srgb, var(--soft) 65%, var(--hover));
}
.history .history-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--body-size);
}
.workspace {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.topbar {
  height: 88px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  gap: 20px;
}
.topbar h2 {
  font-size: 20px;
}
.topbar .subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 5px;
}
.top-actions {
  display: flex;
  gap: 10px;
}
.top-actions button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
}
.top-actions .chat-action {
  position: relative;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 10px;
}
.chat-action:hover,
.chat-action:focus-visible,
.chat-action[aria-expanded="true"] {
  background: var(--hover);
}
.chat-action[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 16px #0002;
  font-size: 13px;
  line-height: 1.6;
  white-space: nowrap;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}
.chat-action[data-tooltip]:focus-visible::after {
  visibility: visible;
  opacity: 1;
}
@media (hover: hover) {
  .chat-action[data-tooltip]:hover::after {
    visibility: visible;
    opacity: 1;
  }
}
.conversation-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  width: 208px;
  max-width: calc(100vw - 16px);
  padding: 7px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 28px #0002;
  -webkit-app-region: no-drag;
}
.conversation-menu::backdrop {
  background: transparent;
}
.conversation-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  font-size: 18px;
  line-height: 1.6;
}
.conversation-menu button:hover,
.conversation-menu button:focus-visible {
  background: var(--hover);
}
.panel {
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.welcome {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 810px;
  min-height: 100%;
  margin: auto;
  padding: 55px 48px;
  gap: 24px;
}
.eyebrow {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
}
.welcome h1 {
  font-size: 38px;
  line-height: 1.4;
}
.welcome > p {
  color: var(--muted);
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 185px), 1fr));
  gap: 20px;
  align-items: start;
}
.person {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  aspect-ratio: 3 / 5;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  container-type: size;
  border: 1px solid #20251b12;
  border-radius: 18px;
  background: #e6e8df;
  color: #fff;
  text-align: left;
}
.person:hover,
.person:focus-visible {
  box-shadow: 0 12px 32px #242d1b18;
}
.portrait-art {
  position: relative;
  display: block;
  overflow: hidden;
  background: #e7e9e0;
}
.person > .portrait-art,
.hero-portrait {
  position: absolute;
  inset: 0;
}
.portrait-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  display: block;
  transition:
    transform 220ms ease,
    filter 220ms ease;
}
.portrait-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 60px;
  color: #526449;
  font:
    72px/1.6 "Songti SC",
    serif;
  background: linear-gradient(145deg, #e7eddc, #b4c8bc);
}
.person:hover img,
.person:focus-visible img {
  transform: scale(1.06);
  filter: blur(5px) brightness(0.8);
}
.person-shade,
.hero-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 25%,
    #101b1220 45%,
    #0c180fee 100%
  );
}
.person-shade {
  transition: background 180ms ease;
}
.person:hover .person-shade,
.person:focus-visible .person-shade {
  background: #0b1516b8;
}
.person-caption {
  position: absolute;
  inset: auto 0 0;
  padding: 42px 19px 20px;
  max-height: 100%;
  overflow: clip;
  pointer-events: none;
}
.person .category {
  display: block;
  color: #ffffffcc;
  font-size: 13px;
  letter-spacing: 0.08em;
  line-height: 1.7;
}
.person .name {
  display: block;
  font:
    500 26px/1.6 "Songti SC",
    "STSong",
    serif;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
}
.person .desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 12;
  font-size: 15px;
  line-height: 1.65;
  color: #ffffffeb;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 200ms ease,
    opacity 180ms ease;
}
.person:hover .desc,
.person:focus-visible .desc {
  max-height: max(0px, calc(100cqh - 140px));
  opacity: 1;
  margin-top: 7px;
}
.person:hover .person-caption,
.person:focus-visible .person-caption {
  padding-top: 18px;
}
.person-cta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  line-height: 1.7;
  margin-top: 8px;
  color: #ffffffbd;
}
.person-cta .icon {
  width: 15px;
  height: 15px;
}
.person[aria-busy="true"] {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}
.welcome-cards {
  width: min(100%, 468px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mobile-history {
  display: none;
}
.top-title {
  display: flex;
  align-items: center;
}
.topbar .mobile-back {
  display: none;
}
.welcome {
  max-width: 920px;
}
.browse-people {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  padding: 0;
  min-height: 32px;
  color: var(--link);
}
.people-page {
  max-width: 1480px;
  padding: 42px 44px;
}
.people-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  margin-bottom: 30px;
}
.people-heading h1 {
  font:
    500 36px/1.6 "Songti SC",
    "STSong",
    serif;
  margin-top: 8px;
}
.people-heading p {
  color: var(--muted);
  margin-top: 8px;
}
.people-search {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--subsurface);
  border-radius: 14px;
  padding: 0 14px;
  min-width: 250px;
  max-width: 320px;
  width: 100%;
  color: var(--muted);
}
.people-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 13px 0;
  border-radius: 0;
  font-size: 16px;
}
.people-index {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 26px;
}
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.category-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 17px;
  font-size: 16px;
  line-height: 1.6;
  white-space: nowrap;
}
.category-tabs button[aria-pressed="true"] {
  background: var(--action);
  border-color: var(--action);
  color: var(--action-text);
}
.category-tabs button span {
  font-size: 12px;
  opacity: 0.65;
}
.people-index > .meta {
  flex: none;
}
.people-empty {
  grid-column: 1 / -1;
}
.page {
  max-width: 1100px;
  margin: auto;
  padding: 35px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}
.page-heading input {
  max-width: 280px;
  width: 100%;
}
.messages {
  max-width: 860px;
  margin: auto;
  padding: 30px 40px 50px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.message {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}
.message .avatar {
  height: 34px;
  width: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--soft);
  font-size: 16px;
  margin-top: 4px;
  overflow: hidden;
}
.message .avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.message.user {
  flex-direction: row-reverse;
}
.message.user .avatar {
  background: var(--hover);
}
.message-body {
  min-width: 0;
  max-width: calc(100% - 49px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.message .who {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.bubble {
  min-width: 0;
  max-width: 100%;
  padding: 16px 20px;
  background: var(--assistant-bubble);
  border: 1px solid var(--line);
  border-radius: 5px 20px 20px 20px;
}
.message.user .message-body {
  align-items: flex-end;
  max-width: min(85%, calc(100% - 49px));
}
.message.user .bubble {
  background: var(--user-bubble);
  border-radius: 20px 5px 20px 20px;
}
.message.user .who {
  display: none;
}
.bubble .text {
  font-size: var(--body-size);
  line-height: var(--body-leading);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble .markdown {
  white-space: normal;
}
.markdown > :first-child {
  margin-top: 0;
}
.markdown > :last-child {
  margin-bottom: 0;
}
.markdown p,
.markdown ul,
.markdown ol,
.markdown blockquote,
.markdown pre,
.markdown table {
  margin: 0 0 0.75em;
}
.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  margin: 1em 0 0.4em;
  font-size: 1.12em;
  line-height: 1.6;
  font-weight: 650;
}
.markdown h1 {
  font-size: 1.3em;
}
.markdown h2 {
  font-size: 1.2em;
}
.markdown strong {
  font-weight: 650;
}
.markdown ul,
.markdown ol {
  padding-left: 1.5em;
}
.markdown li + li {
  margin-top: 0.25em;
}
.markdown li > p {
  margin-bottom: 0.3em;
}
.markdown blockquote {
  padding-left: 0.8em;
  border-left: 3px solid var(--muted);
}
.markdown a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.markdown code {
  font-family: ui-monospace, monospace;
  background: var(--hover);
  border-radius: 4px;
  padding: 0.1em 0.25em;
  overflow-wrap: anywhere;
}
.markdown pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 0.6em;
  background: var(--hover);
  border-radius: 8px;
}
.markdown pre code {
  background: none;
  padding: 0;
}
.markdown table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}
.markdown th,
.markdown td {
  padding: 0.35em 0.6em;
  border: 1px solid var(--line);
  text-align: left;
  min-width: 4em;
}
.markdown hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.8em 0;
}
.message .tools {
  margin-top: 6px;
  display: flex;
  gap: 8px;
}
.message .tools button {
  font-size: 13px;
  color: var(--muted);
  padding: 7px 6px;
  min-height: 36px;
  border-radius: 8px;
}
.message .tools button:hover {
  background: var(--hover);
}
.typing {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}
.typing::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aaf78;
  margin-right: 12px;
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}
.composer-area {
  flex-shrink: 0;
  padding: 10px 32px 20px;
  background: var(--surface);
}
.composer-wrap {
  max-width: 780px;
  margin: auto;
}
.composer {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--subsurface);
  box-shadow: 0 6px 25px #00000004;
  padding: 14px;
}
.composer textarea {
  border: 0;
  background: none;
  display: block;
  resize: none;
  width: 100%;
  min-height: 62px;
  max-height: 200px;
  padding: 3px 6px;
}
.composer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 4px 0;
}
.composer-bottom .hint {
  font-size: 12px;
  color: var(--muted);
}
.send {
  height: 38px;
  min-width: 64px;
  border-radius: 12px;
  background: var(--action);
  color: var(--action-text);
  font-size: 14px;
  padding: 0 15px;
}
.privacy {
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
  color: var(--muted);
  padding-top: 10px;
}
.composer-error {
  margin-bottom: 10px;
}
.list-row {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.list-row > button {
  text-align: left;
}
.list-row p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.review-answer {
  padding: 20px;
  background: var(--subsurface);
  border-radius: 16px;
  margin: 15px 0;
}
.review-answer pre {
  font-family: inherit;
  white-space: pre-wrap;
  font-size: 18px;
  line-height: 1.7;
}
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.form-stack textarea {
  min-height: 130px;
}
.form-stack label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.badge {
  background: var(--soft);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 12px;
  color: var(--link);
}
.mobile-back {
  display: none;
}
.notice {
  font-size: 18px;
  line-height: 1.7;
  background: var(--soft);
  padding: 18px 22px;
  border-radius: 15px;
  margin-bottom: 20px;
}
.account-line {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
}
.member-form {
  margin-bottom: 25px;
}
.member-form input {
  width: 100%;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  max-width: min(760px, calc(100vw - 32px));
  max-height: 85dvh;
  width: 650px;
  color: var(--ink);
  background: var(--surface);
}
dialog::backdrop {
  background: #20251e55;
  backdrop-filter: blur(4px);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.modal-head button {
  font-size: 25px;
}
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-body pre {
  font: inherit;
  font-size: 18px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.modal-body input,
.modal-body textarea {
  width: 100%;
}
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #22271f;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 16px;
  line-height: 1.7;
  z-index: 20;
  display: none;
  max-width: 90vw;
}
#toast.visible {
  display: block;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
@media (max-width: 1050px) {
  .shell {
    grid-template-columns: 70px 235px minmax(0, 1fr);
  }
  .welcome {
    padding: 35px;
  }
  .welcome h1 {
    font-size: 31px;
  }
  .topbar {
    padding: 0 22px;
  }
  .login {
    padding: 40px;
    gap: 45px;
  }
  .login-story h1 {
    font-size: 42px;
  }
  .messages {
    padding: 25px;
  }
}
@media (max-width: 720px) {
  .mobile-history {
    display: block;
  }
  .topbar .mobile-back {
    display: inline-flex;
  }
  .login {
    display: block;
    padding: 30px 20px;
  }
  .login-story {
    gap: 16px;
    margin-bottom: 30px;
  }
  .login-story h1 {
    font-size: 32px;
  }
  .login-art {
    display: none;
  }
  .login-card {
    padding: 25px;
  }
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 68px;
  }
  .rail {
    grid-row: 2;
    flex-direction: row;
    padding: 0 8px;
    border-right: 0;
    border-top: 1px solid var(--line);
    justify-content: space-around;
    gap: 0;
  }
  .rail img {
    display: none;
  }
  .rail button {
    width: 58px;
    min-height: 54px;
  }
  .rail .bottom {
    margin-top: 0;
  }
  .sidebar {
    display: none;
  }
  .workspace {
    grid-row: 1;
  }
  .topbar {
    height: 76px;
    padding: 0 18px;
  }
  .top-actions {
    gap: 5px;
  }
  .top-actions button {
    padding: 8px;
  }
  .welcome {
    padding: 28px 22px;
    gap: 20px;
  }
  .welcome h1 {
    font-size: 30px;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .person {
    padding: 20px;
  }
  .messages {
    padding: 22px 17px 35px;
    gap: 23px;
  }
  .message {
    gap: 10px;
  }
  .message .avatar {
    height: 30px;
    width: 30px;
    flex-basis: 30px;
    font-size: 14px;
  }
  .composer-area {
    padding: 8px 12px 12px;
  }
  .composer-bottom .hint {
    display: none;
  }
  .composer-bottom {
    justify-content: flex-end;
  }
  .privacy {
    font-size: 12px;
  }
  .page {
    padding: 24px 18px;
  }
  .page-heading {
    flex-wrap: wrap;
  }
  .top-actions .hide-mobile {
    display: none;
  }
  .shell.in-chat .rail {
    display: none;
  }
  .shell.in-chat {
    grid-template-rows: 1fr;
  }
  .mobile-back {
    display: inline-flex;
    margin-right: 10px;
  }
  .top-title {
    display: flex;
    align-items: center;
  }
  .composer {
    padding: 11px;
  }
  .message-body,
  .message.user .message-body {
    max-width: calc(100% - 40px);
  }
  .message .tools button {
    min-height: 44px;
  }
  .panel {
    overscroll-behavior: contain;
  }
  .composer textarea {
    font-size: var(--body-size);
    line-height: var(--body-leading);
  }
}

/* Shared desktop and web shell: Lucide controls and portrait-first navigation. */
.icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: none;
  vertical-align: middle;
}
.rail button > .icon {
  width: 23px;
  height: 23px;
}
.rail button > span {
  font-size: 12px;
  line-height: 1.4;
}
button.icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px;
}
button.icon-only > span {
  display: none;
}
.top-actions button,
.send,
.message .tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.top-actions button .icon {
  width: 17px;
  height: 17px;
}
.shell.no-sidebar {
  grid-template-columns: 80px minmax(0, 1fr);
}
.sidebar {
  padding: 0;
}
.side-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 16px;
  min-height: 74px;
}
.side-heading > span {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.view-switch {
  display: flex;
  flex: none;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
}
.view-switch button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  color: var(--muted);
}
.view-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 5px #0000000a;
}
.view-switch .icon {
  width: 17px;
  height: 17px;
}
.active-person {
  position: relative;
  flex: 1;
  min-height: 180px;
  margin: 0 12px;
  border-radius: 18px;
  overflow: hidden;
  background: #d9e2d1;
  isolation: isolate;
}
.hero-caption {
  position: absolute;
  inset: auto 0 0;
  padding: 45px 22px 24px;
  color: white;
  max-height: 70%;
  overflow: auto;
}
.hero-caption > span {
  font-size: 13px;
  line-height: 1.7;
  color: #ffffffb8;
}
.hero-caption h2 {
  font:
    500 29px/1.6 "Songti SC",
    "STSong",
    serif;
  margin: 4px 0 10px;
}
.hero-caption p {
  font-size: var(--body-size);
  line-height: var(--body-leading);
  color: #ffffffdf;
}
.side-controls {
  display: flex;
  flex: none;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  min-height: 72px;
}
.side-controls > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 10px;
  padding: 12px 9px;
  font-size: 14px;
}
.side-controls button:hover {
  background: var(--hover);
}
.side-controls .icon {
  width: 18px;
  height: 18px;
}
.side-action .primary {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
}
.agent-history-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 20px 20px;
}
.agent-history-head > .portrait-art {
  width: 44px;
  height: 54px;
  border-radius: 9px;
  flex: none;
}
.agent-history-head h2 {
  font-size: 18px;
}
.history button.history-person {
  display: block;
}
.history-person + .history-person {
  position: relative;
}
.history-person + .history-person::before {
  content: "";
  position: absolute;
  inset: 0 12px auto;
  height: 1px;
  background: var(--line);
  opacity: 0.65;
  pointer-events: none;
}
.history-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
  white-space: nowrap;
}
.history-rounds {
  flex: none;
  font-variant-numeric: tabular-nums;
}
.history-empty {
  padding: 12px;
}
.agent-history-head .portrait-fallback {
  font-size: 22px;
  min-height: 0;
}
.account-menu {
  position: fixed;
  inset: auto auto 88px 12px;
  margin: 0;
  width: 304px;
  max-width: calc(100vw - 24px);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow:
    0 18px 70px #18251025,
    0 3px 12px #1825100a;
}
.account-menu {
  overflow-y: auto;
  overscroll-behavior: contain;
}
.account-menu::backdrop {
  background: transparent;
}
.menu-identity {
  display: flex;
  gap: 13px;
  padding: 14px 12px 18px;
  align-items: center;
}
.account-avatar {
  display: grid;
  place-items: center;
  width: 47px;
  height: 47px;
  border-radius: 15px;
  background: var(--soft);
  font-size: 22px;
  flex: none;
}
.menu-identity strong {
  display: block;
  font-size: 18px;
  line-height: 1.6;
}
.menu-identity div > span {
  display: block;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.menu-items {
  border-top: 1px solid var(--line);
  padding: 7px 0;
}
.menu-items button {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  text-align: left;
  font-size: 16px;
}
.menu-items button:hover,
.menu-items button:focus-visible {
  background: var(--hover);
}
.menu-items button > span {
  flex: 1;
}
.menu-items button > .icon:last-child:not(:first-child) {
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.menu-exit {
  padding-bottom: 0;
}
.menu-version {
  padding: 8px 12px 4px;
  font-size: 12px;
  color: var(--muted);
}
.profile-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding: 16px;
}
.profile-summary .account-avatar {
  width: 72px;
  height: 72px;
  font-size: 32px;
  border-radius: 22px;
}
.about-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.about-brand img {
  width: 48px;
  height: 48px;
}
@media (max-width: 1050px) {
  .shell.no-sidebar {
    grid-template-columns: 70px minmax(0, 1fr);
  }
  .people-page {
    padding: 30px;
  }
  .people-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }
  .people-search {
    max-width: 380px;
  }
  .hero-caption {
    padding: 30px 17px 20px;
  }
  .side-controls {
    flex-wrap: wrap;
  }
}
@media (max-width: 720px) {
  .shell.no-sidebar {
    grid-template-columns: 1fr;
  }
  .rail button {
    flex: 1;
    min-width: 0;
    width: auto;
  }
  .rail .bottom {
    margin: 0;
  }
  .people-page {
    padding: 26px 18px;
  }
  .people-heading {
    gap: 18px;
    margin-bottom: 22px;
  }
  .people-heading h1 {
    font-size: 30px;
  }
  .people-search {
    max-width: none;
  }
  .people-index {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
    margin-bottom: 20px;
  }
  .category-tabs {
    gap: 7px;
  }
  .category-tabs button {
    padding: 7px 13px;
  }
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
  }
  .person {
    padding: 0;
    border-radius: 14px;
  }
  .person-caption {
    padding: 30px 13px 16px;
  }
  .person .name {
    font-size: 23px;
  }
  .person .desc {
    font-size: 14px;
    line-height: 1.65;
  }
  .welcome-cards {
    width: 100%;
  }
  .welcome {
    padding: 28px 20px;
  }
  .mobile-history h3 {
    margin-bottom: 18px;
  }
  .mobile-history .cards {
    margin-bottom: 24px;
  }
  .hero-caption p {
    font-size: var(--body-size);
    line-height: var(--body-leading);
  }
}
@media (prefers-reduced-motion: reduce) {
  .portrait-art img,
  .person-shade,
  .person .desc {
    transition: none;
  }
}
@media (hover: none) {
  .person .desc {
    max-height: 92px;
    opacity: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
  }
}

/* Semantic appearance tokens also cover menus, form controls and native dialogs. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171b18;
  --surface: #1c211e;
  --ink: #edf1e9;
  --muted: #b0b9ac;
  --line: #3e493e;
  --rail: #151a16;
  --subsurface: #202721;
  --soft: #2b3829;
  --hover: #303a31;
  --action: #d2ed91;
  --action-text: #20271a;
  --error: #ffaaa5;
  --link: #c6dfa7;
  --focus: #d2ed91;
  --assistant-bubble: #28312a;
  --user-bubble: #35452c;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
}
.login-art span:nth-child(2) {
  color: var(--accent-ink);
}
.auto-read {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 1.7;
  white-space: nowrap;
  color: var(--muted);
  cursor: pointer;
}
.auto-read input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--focus);
}
.auto-read.preference {
  font-size: 18px;
  color: var(--ink);
}
.composer-bottom .hint {
  margin-left: auto;
}
.sync-trigger[aria-busy="true"] .icon {
  animation: sync-spin 1.2s linear infinite;
}
@keyframes sync-spin {
  to {
    transform: rotate(360deg);
  }
}
#update-bubble {
  position: fixed;
  z-index: 15;
  right: 24px;
  bottom: 24px;
  width: min(360px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 14px 60px #0004;
}
#update-bubble strong {
  font-size: 20px;
}
#update-bubble p {
  margin: 10px 0 20px;
}
#update-bubble button {
  width: 100%;
}
.desktop-app .rail {
  padding-top: 58px;
  -webkit-app-region: drag;
}
.desktop-app .rail img {
  margin-bottom: 12px;
}
.desktop-app .topbar,
.desktop-app .side-heading {
  -webkit-app-region: drag;
}
.desktop-app button,
.desktop-app input,
.desktop-app select,
.desktop-app textarea,
.desktop-app .account-menu {
  -webkit-app-region: no-drag;
}
.window-controls {
  position: fixed;
  right: 0;
  top: 0;
  display: flex;
  z-index: 30;
}
.window-controls button {
  width: 44px;
  height: 28px;
}
.window-controls button:hover {
  background: var(--hover);
}
.desktop-windows .topbar {
  padding-right: 140px;
}
@media (max-width: 720px) {
  .rail {
    overflow-x: auto;
    justify-content: flex-start;
  }
  .rail button {
    flex-shrink: 0;
  }
  .auto-read {
    margin-right: auto;
  }
  #update-bubble {
    bottom: 82px;
    right: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (min-width: 721px) and (max-height: 760px) {
  .desktop-app .rail {
    padding: 44px 8px 12px;
    gap: 4px;
  }
  .desktop-app .rail img {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
  }
  .desktop-app .rail button {
    min-height: 44px;
    gap: 3px;
  }
  .desktop-app .rail button > .icon {
    width: 20px;
    height: 20px;
  }
}

/* Cloud connections use the same semantic colors in light and dark mode. */
#connections {
  min-width: 0;
}
#connections h3 {
  margin: 24px 0 12px;
}
#connections h4 {
  font-size: var(--body-size);
  margin: 0;
}
#connections p,
#connections label,
#connections summary {
  font-size: var(--body-size);
  line-height: var(--body-leading);
  overflow-wrap: anywhere;
}
#connections a {
  color: var(--link);
  font-size: var(--body-size);
  line-height: var(--body-leading);
}
.connection-providers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.connection-provider {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--subsurface);
  border-radius: 16px;
  padding: 18px 14px;
  font-size: var(--body-size);
  line-height: var(--body-leading);
}
.connection-provider .icon:last-child {
  margin-left: auto;
  flex-shrink: 0;
}
.connection-provider:hover {
  background: var(--hover);
}
.connection-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.connection-card,
.connection-empty {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--subsurface);
  overflow-wrap: anywhere;
}
.connection-card p {
  margin: 10px 0;
}
.connection-card-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
}
.connection-actions,
.connection-submit {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
}
.connection-tools {
  padding-left: 24px;
}
.connection-tools strong {
  overflow-wrap: anywhere;
}
#connection-form [data-mode]:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#connection-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#connection-form input,
#connection-form select {
  min-width: 0;
  width: 100%;
  font-size: var(--body-size);
  line-height: var(--body-leading);
}
.connection-message:empty {
  display: none;
}
.connection-progress {
  color: var(--muted);
  font-size: var(--body-size);
  line-height: var(--body-leading);
}
.connection-submit {
  position: sticky;
  bottom: -28px;
  background: var(--surface);
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.disconnect-confirm {
  border-top: 1px solid var(--line);
  margin-top: 12px;
}
.connection-help {
  margin-top: 24px;
}
#connections .connection-login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--action-text);
  text-decoration: none;
}
@media (max-width: 520px) {
  .connection-providers {
    grid-template-columns: 1fr;
  }
  .connection-card,
  .connection-empty {
    padding: 14px;
  }
  .top-actions [data-action="connections"] {
    font-size: 14px;
  }
}
#modal:has(#connections) .modal-head {
  position: sticky;
  top: -28px;
  z-index: 3;
  background: var(--surface);
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
#connections .field-error {
  font-size: var(--body-size);
  line-height: var(--body-leading);
}

/* Generic management: the same readable content on desktop and phones. */
.admin-page {
  max-width: 1280px;
}
.admin-heading {
  margin-bottom: 26px;
}
.admin-heading p {
  margin-top: 12px;
}
.admin-tabs,
.admin-shortcuts,
.admin-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.admin-tabs {
  margin: 24px 0;
}
.admin-tabs [aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.admin-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  background: var(--surface);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
}
.admin-filters label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  font-size: var(--body-size);
  line-height: var(--body-leading);
}
.admin-filters input,
.admin-filters select {
  width: 100%;
  min-width: 0;
}
.admin-filters > .primary {
  align-self: end;
}
.admin-shortcuts {
  grid-column: 1 / -1;
}
.admin-note {
  color: var(--muted);
  margin: 18px 0;
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.admin-stats article {
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.admin-stats span {
  font-size: var(--body-size);
  line-height: var(--body-leading);
}
.admin-stats strong {
  font-size: 30px;
}
.admin-usage {
  padding: 22px;
  background: var(--soft);
  border-radius: 18px;
}
.admin-usage p {
  margin-top: 10px;
}
.admin-result-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 28px 0 16px;
}
.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.admin-row p {
  margin: 6px 0;
}
.admin-row button {
  margin-top: 10px;
}
.admin-pagination {
  margin: 24px 0;
}
.admin-prices {
  max-width: 760px;
}
.admin-prices > p,
.admin-prices form {
  margin: 18px 0 28px;
}
.admin-prices select,
.admin-prices input {
  min-width: 0;
  width: 100%;
}
.admin-price-history {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.admin-turn {
  margin: 26px 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.admin-message {
  margin: 16px 0;
  padding: 16px;
  background: var(--subsurface);
  border-radius: 12px;
}
.admin-message pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: var(--body-size);
  line-height: var(--body-leading);
  margin: 10px 0 0;
}
.admin-detail {
  overflow-wrap: anywhere;
}
.admin-detail > p {
  margin-top: 12px;
}
.admin-call {
  padding: 14px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.admin-call summary {
  cursor: pointer;
  font-size: var(--body-size);
  line-height: var(--body-leading);
}
.admin-call p {
  margin-top: 10px;
}
.admin-error {
  padding: 24px 0;
}
.admin-error button {
  margin-top: 16px;
}
.rail {
  overflow-y: auto;
  flex-shrink: 0;
}
.rail > button {
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .admin-page {
    padding: 22px 16px;
  }
  .admin-filters {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
  }
  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-stats article {
    padding: 14px;
  }
  .admin-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .admin-usage {
    padding: 16px;
  }
  .admin-tabs button {
    flex: 1 0 auto;
  }
  .rail {
    overflow-y: hidden;
  }
}
#modal:has(.admin-detail) .modal-head {
  position: sticky;
  top: -28px;
  z-index: 2;
  padding: 16px 0;
  background: var(--surface);
}
@media (max-width: 720px) {
  .admin-filters > .primary {
    position: sticky;
    bottom: 12px;
    z-index: 1;
    box-shadow: 0 4px 18px #0002;
  }
}

/* Shared brand editor and employee results: all colors inherit semantic tokens. */
.welcome-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 24px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}
.welcome-examples span {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.brand-page {
  max-width: 1440px;
  width: 100%;
}
.brand-toolbar,
.brand-actions,
.work-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.brand-toolbar {
  justify-content: space-between;
  margin-bottom: 24px;
}
.brand-toolbar .field {
  min-width: 220px;
}
.brand-actions {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 16px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.brand-actions p {
  width: 100%;
  color: var(--muted);
}
.brand-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
  gap: 44px;
}
.brand-editor-grid h3 {
  margin-top: 20px;
}
.brand-editor-grid input,
.brand-editor-grid textarea {
  width: 100%;
  min-width: 0;
}
.brand-editor-grid fieldset {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  min-width: 0;
}
.brand-colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.brand-previews {
  position: sticky;
  top: 130px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.brand-preview {
  background: #fff;
  color: #22271f;
  border: 1px solid #d9dfd6;
  border-radius: 22px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-wrap: anywhere;
}
.brand-preview p {
  color: inherit;
}
.dark-preview {
  background: #171b18;
  color: #edf1e9;
  border-color: #3e493e;
}
.preview-bubble {
  font-size: 18px;
  line-height: 1.7;
  border-radius: 16px;
  padding: 14px;
}
.preview-accent {
  align-self: flex-start;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 18px;
  line-height: 1.6;
}
.brand-builds,
.extension-settings {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.brand-builds .field {
  width: 100%;
}
.brand-builds input {
  width: 100%;
}
.work-products {
  background: var(--paper);
  color: var(--ink);
  border: 0;
  border-left: 1px solid var(--line);
  width: 320px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.work-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 18px;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.work-person {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.work-person img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
}
.work-person div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.work-person strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}
.work-person span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.work-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--line);
  overflow-y: auto;
  max-height: 50%;
  flex-shrink: 0;
}
.work-controls h2 {
  font-size: 22px;
  overflow-wrap: anywhere;
}
.work-controls select {
  width: 100%;
}
.work-controls .primary {
  font-size: 16px;
}
.work-status {
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
}
.work-link {
  padding: 0;
  align-self: flex-start;
  color: var(--link);
  font-size: 18px;
  line-height: 1.6;
}
.work-list {
  flex: 1;
  overflow: auto;
  padding: 18px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.work-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-wrap: anywhere;
}
.work-card h3 {
  font-size: 19px;
  line-height: 1.6;
}
.work-card p {
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.work-card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.work-card .secondary {
  align-self: flex-start;
}
.work-empty {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--muted);
  padding: 20px 0;
}
.work-empty p {
  font-size: 18px;
  line-height: 1.6;
}
.work-drawer {
  margin: auto;
  width: min(420px, calc(100vw - 24px));
  height: min(850px, 90dvh);
  max-height: 90dvh;
  border: 1px solid var(--line);
  border-radius: 22px;
}
.work-drawer[open] {
  display: flex;
}
.work-drawer::backdrop {
  background: #0006;
}
.work-edit-form {
  margin-top: 24px;
}
.work-edit-form textarea {
  min-height: 240px;
}
.work-document {
  margin: 20px 0;
  overflow-wrap: anywhere;
}
.work-version {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.work-version summary {
  cursor: pointer;
  font-size: 18px;
  line-height: 1.6;
}
@media (min-width: 1280px) {
  .shell.has-work-products.in-chat {
    grid-template-columns: 80px 260px minmax(0, 1fr) 320px;
  }
  .shell.has-work-products #work-products {
    display: flex;
  }
  .shell.has-work-products .topbar {
    padding: 0 20px;
    gap: 12px;
  }
  .shell.has-work-products .top-actions {
    gap: 8px;
  }
  .shell.has-work-products .messages {
    padding-left: 24px;
    padding-right: 24px;
  }
}
@media (max-width: 1000px) {
  .brand-editor-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .brand-previews {
    position: static;
  }
}
@media (max-width: 720px) {
  .brand-page {
    padding: 22px 16px;
  }
  .brand-colors {
    grid-template-columns: 1fr;
  }
  .brand-actions {
    gap: 8px;
  }
  .brand-actions button {
    padding: 10px 12px;
  }
  .top-actions button[data-action="work-products"] span {
    display: none;
  }
  .work-drawer {
    height: 90dvh;
  }
}
/* Enterprise chat: shared visual language, independent membership and drafts. */
@media (max-width: 720px) {
  .in-chat .topbar {
    gap: 8px;
    padding-inline: 12px;
  }
  .in-chat .top-title {
    flex: 1;
    min-width: 0;
  }
  .in-chat .top-title > div {
    min-width: 0;
  }
  .in-chat .top-title h2,
  .in-chat .top-title .subtitle {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .in-chat .mobile-back {
    flex: none;
    margin-right: 4px;
  }
  .in-chat .top-actions {
    flex: none;
  }
  .in-chat .top-actions .chat-action {
    width: 38px;
    height: 40px;
  }
}
.agent-tag {
  display: inline-block;
  vertical-align: middle;
  margin-left: 10px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 450;
  line-height: 1.7;
}
.top-title h2 {
  line-height: 1.6;
}
.social-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.social-list {
  border-right: 1px solid var(--line);
  background: var(--subsurface);
  padding: 20px 12px;
  overflow-y: auto;
}
.social-list input {
  width: 100%;
}
.social-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 10px;
  text-align: left;
  border-radius: 12px;
}
.social-item:hover,
.social-item:focus-visible {
  background: var(--hover);
}
.social-item.selected {
  background: var(--soft);
}
.social-item > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.social-item strong,
.social-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.social-item strong {
  font-size: 18px;
  line-height: 1.6;
}
.social-item small {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.colleague-avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--soft);
  color: var(--ink);
  font-size: 16px;
}
.unread-count {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 12px;
  padding: 2px 7px;
  font-size: 12px;
}
.social-conversation {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.social-room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
}
.social-room-header h2 {
  line-height: 1.6;
}
.social-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px;
}
.social-messages {
  width: 100%;
  max-width: none;
  margin: 0;
  gap: 24px;
}
.social-messages .message {
  width: 100%;
  max-width: 850px;
  margin: 0 auto;
}
.social-messages .who,
.social-messages .user .who {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.social-messages .who time {
  font-size: 12px;
}
.social-messages .bubble {
  font-size: var(--body-size);
  line-height: var(--body-leading);
}
.plain-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.shared-record {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: normal;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-top: 10px;
  max-width: 100%;
}
.shared-record strong,
.shared-record small {
  display: block;
}
.shared-record small {
  color: var(--muted);
  font-size: 13px;
}
.group-mentions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  border: 0;
  padding: 8px 0;
  font-size: 15px;
  line-height: 1.7;
}
.group-mentions legend {
  color: var(--muted);
  font-size: 13px;
}
.member-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  font-size: 18px;
  line-height: 1.7;
}
.member-picker label {
  padding: 6px;
}
#modal:has(#group-form) {
  width: 680px;
  height: min(780px, 90dvh);
  max-height: 90dvh;
  padding: 0;
  overflow: hidden;
}
#modal:has(#group-form)[open] {
  display: flex;
  flex-direction: column;
}
#modal:has(#group-form) .modal-head {
  flex: none;
  gap: 16px;
  margin: 0;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
#modal:has(#group-form) .modal-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#group-form {
  flex: 1;
  min-height: 0;
  gap: 0;
}
.group-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  scrollbar-gutter: stable;
}
.group-scroll > * {
  flex: none;
}
.group-scroll .member-picker {
  display: block;
  min-inline-size: 0;
  margin: 0;
}
.group-footer {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.group-footer .primary {
  width: 100%;
  font-size: 18px;
  line-height: 1.6;
}
.group-footer .error:empty {
  display: none;
}
.group-scroll .agent-picker {
  display: block;
}
.group-avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 14px;
}
.group-avatar-grid .member-choice {
  position: relative;
  display: block;
  justify-self: center;
  width: 76px;
  height: 76px;
  padding: 6px;
  cursor: pointer;
}
.member-choice-avatar {
  display: block;
  width: 64px;
  height: 64px;
  border: 2px solid transparent;
  border-radius: 16px;
  object-fit: cover;
  background: var(--soft);
}
.member-choice-fallback {
  display: grid;
  place-items: center;
  color: var(--ink);
}
.member-choice-fallback .icon {
  width: 32px;
  height: 32px;
}
.member-choice > input {
  appearance: none;
  position: absolute;
  z-index: 1;
  top: 1px;
  right: 1px;
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  border: 2px solid var(--muted);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}
.member-choice > input:checked {
  border-color: var(--action);
  background: var(--action);
}
.member-choice > input:checked ~ .member-choice-avatar {
  border-color: var(--action);
}
.member-choice-check {
  position: absolute;
  z-index: 2;
  top: 1px;
  right: 1px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--action-text);
  opacity: 0;
  pointer-events: none;
}
.member-choice-check .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
}
.member-choice > input:checked ~ .member-choice-check {
  opacity: 1;
}
.group-member-tooltip {
  position: fixed;
  z-index: 5;
  max-width: min(320px, calc(100vw - 64px));
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 16px #0002;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  pointer-events: none;
}
@media (max-width: 520px) {
  #modal:has(#group-form) .modal-head {
    padding: 16px;
  }
  .group-scroll {
    padding: 16px;
  }
  .group-scroll .member-picker {
    padding: 12px;
  }
  .group-footer {
    padding: 12px 16px;
  }
}
.share-preview {
  max-height: 38vh;
  overflow-y: auto;
  background: var(--subsurface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}
.transcript-records {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.transcript-turn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  font-size: var(--body-size, 18px);
  line-height: 1.7;
}
.transcript-user {
  align-items: flex-end;
}
.transcript-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 6px;
}
.transcript-user .transcript-meta {
  justify-content: flex-end;
}
.transcript-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  background: var(--assistant-bubble, var(--surface));
  color: var(--ink);
  overflow-wrap: anywhere;
  min-width: 0;
}
.transcript-user .transcript-bubble {
  background: var(--user-bubble, var(--subsurface));
  border-radius: 16px 16px 4px 16px;
}
.transcript-bubble > :first-child {
  margin-top: 0;
}
.transcript-bubble > :last-child {
  margin-bottom: 0;
}
.transcript-bubble pre {
  overflow-x: auto;
}
@media (max-width: 480px) {
  .transcript-bubble {
    max-width: 95%;
  }
  .share-preview {
    padding: 12px;
  }
}
.social-empty {
  padding: 20px 10px;
}
.social-back {
  display: none;
}
.social-conversation > .empty {
  flex: 1;
}
@media (max-width: 760px) {
  .social-layout {
    grid-template-columns: 1fr;
  }
  .social-conversation {
    display: none;
  }
  .social-layout.room-open .social-list {
    display: none;
  }
  .social-layout.room-open .social-conversation {
    display: flex;
  }
  .social-back {
    display: inline-flex;
  }
  .social-room-header {
    padding: 16px;
  }
  .social-messages {
    padding: 18px 12px;
  }
  .social-messages .bubble {
    max-width: 96%;
  }
  .social-room-header h2 {
    font-size: 20px;
  }
  .agent-tag {
    font-size: 12px;
    margin-left: 6px;
  }
  .social-room-header .secondary {
    font-size: 14px;
    padding: 8px;
  }
  .social-room-header > div {
    flex: 1;
  }
  .top-title h2 .agent-tag {
    margin-top: 3px;
  }
}
.brand img[data-brand-logo],
.about-brand img[data-brand-logo] {
  width: 100px;
  height: 50px;
  object-fit: contain;
  border-radius: 8px;
}
.brand-logo-preview {
  width: 160px;
  height: 80px;
  object-fit: contain;
  border-radius: 8px;
}
.brand-preview .preview-bubble {
  color: inherit;
}
.social-room-header .social-back {
  display: none;
}
.social-room-header > div {
  margin-right: auto;
}
@media (max-width: 760px) {
  .social-room-header .social-back {
    display: inline-flex;
  }
}

/* Quiet login and public desktop downloads. */
.login {
  gap: 42px 80px;
  padding-top: 52px;
  padding-bottom: 52px;
}
.login > .desktop-downloads {
  grid-column: 1 / -1;
}
.desktop-downloads {
  min-width: 0;
}
.download-heading {
  display: flex;
  gap: 16px;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.download-heading h2 {
  font-size: 24px;
  line-height: 1.6;
}
.download-heading p,
.download-note {
  color: var(--muted);
  font-size: var(--body-size);
  line-height: 1.6;
}
.download-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.download-platform {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 18px;
  padding: 22px;
  min-width: 0;
}
.download-platform h3 {
  margin: 0 0 5px;
  font-size: 21px;
}
.download-platform p {
  margin-bottom: 14px;
  color: var(--muted);
}
.download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.download-link {
  display: inline-flex;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--action);
  color: var(--action-text);
  text-decoration: none;
  font-size: var(--body-size);
  line-height: 1.6;
}
.download-link:hover {
  filter: brightness(0.92);
}
.download-link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.download-note {
  margin-top: 15px;
}
.download-page {
  max-width: 1180px;
  margin: auto;
  padding: 64px 32px;
}
.download-page > a {
  color: var(--muted);
}
.download-page > h1 {
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.4;
  margin: 44px 0 12px;
}
.download-page > p {
  color: var(--muted);
  margin-bottom: 32px;
}
.download-error {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.download-error button {
  margin-top: 12px;
  text-decoration: underline;
}
@media (max-width: 760px) {
  .download-grid {
    grid-template-columns: 1fr;
  }
  .login {
    padding: 28px 22px;
    gap: 28px;
  }
  .download-platform {
    padding: 20px;
  }
  .download-page {
    padding: 30px 22px;
  }
}

#modal:has([data-dialog-downloads]) {
  width: 1100px;
  max-width: calc(100vw - 32px);
}

/* App chrome is not a document. Only message bodies and explicit reading/editing areas select. */
body {
  -webkit-user-select: none;
  user-select: none;
}
input,
textarea,
[contenteditable="true"],
.selectable,
.selectable *,
.message .text,
.message .text * {
  -webkit-user-select: text;
  user-select: text;
}
img {
  -webkit-user-drag: none;
}
.excerpt-toolbar {
  position: fixed;
  z-index: 45;
  display: flex;
  gap: 2px;
  max-width: calc(100vw - 16px);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 28px #0003;
}
.excerpt-toolbar[hidden] {
  display: none;
}
.excerpt-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  font-size: 14px;
  line-height: 1.6;
  border-radius: 7px;
}
.excerpt-toolbar .icon {
  width: 16px;
  height: 16px;
}
.excerpt-toolbar button[aria-pressed="true"],
.excerpt-attitude button[aria-pressed="true"] {
  background: var(--action);
  color: var(--action-text);
}
.excerpt-toolbar[aria-busy="true"] {
  cursor: progress;
}
::highlight(excerpt-agree) {
  background: #70b48735;
  text-decoration: underline #528f65;
}
::highlight(excerpt-disagree) {
  background: #e2887f35;
  text-decoration: underline #bf625b;
}
::highlight(excerpt-note) {
  background: #879ede35;
  text-decoration: underline #718cc8;
}
::highlight(excerpt-favorite) {
  background: #d7b65240;
  text-decoration: underline #b99936;
}
.annotation-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px;
}
.annotation-notes[hidden] {
  display: none;
}
.annotation-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--muted);
  background: var(--soft);
  font-size: 13px;
  line-height: 1.6;
}
.annotation-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.annotation-chip .icon {
  width: 14px;
  height: 14px;
  flex: none;
}
.excerpt-quote {
  margin: 0;
  padding: 14px 18px;
  border-left: 3px solid var(--focus);
  border-radius: 0 10px 10px 0;
  background: var(--soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--body-size);
  line-height: var(--body-leading);
  max-height: 35vh;
  overflow-y: auto;
}
.excerpt-attitude,
.excerpt-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.excerpt-library-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.excerpt-library-tools label:first-child {
  flex: 1;
  min-width: min(100%, 240px);
}
.excerpt-library-tools select {
  max-width: 100%;
}
.excerpt-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.excerpt-meta strong {
  color: var(--ink);
  font-size: 18px;
}
.excerpt-comment {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--body-size);
  line-height: var(--body-leading);
}
.excerpt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
}
.excerpt-tags span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.excerpt-tags .icon {
  width: 16px;
  height: 16px;
}
.excerpt-source-focus .bubble {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}
@media (max-width: 520px) {
  .excerpt-toolbar {
    gap: 0;
    padding: 4px;
  }
  .excerpt-toolbar button {
    gap: 3px;
    padding: 7px 6px;
    font-size: 12px;
  }
  .excerpt-toolbar .icon {
    width: 14px;
    height: 14px;
  }
  .excerpt-library-tools > label {
    width: 100%;
  }
}

/* Personal library: global rail, category sidebar, responsive card grid. */
.shell.library-shell {
  grid-template-columns: 80px 250px minmax(0, 1fr);
}
.library-sidebar .side-heading {
  min-height: 88px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.library-sidebar h2 {
  font-size: 20px;
}
.library-categories {
  padding: 20px 14px;
  overflow-y: auto;
  min-height: 0;
}
.library-categories section + section {
  margin-top: 24px;
}
.library-categories h3 {
  margin: 0 0 6px;
}
.library-categories h3 button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border-radius: 9px;
  text-align: left;
  font-size: var(--body-size);
  line-height: var(--body-leading);
}
.library-category {
  display: block;
  width: 100%;
  padding: 9px 12px 9px 40px;
  border-radius: 9px;
  text-align: left;
  color: var(--muted);
  font-size: var(--body-size);
  line-height: var(--body-leading);
}
.library-category:hover,
.library-categories h3 button:hover {
  background: var(--hover);
}
.library-category[aria-pressed="true"] {
  color: var(--ink);
  background: var(--soft);
  font-weight: 600;
}
button.library-close,
#library-toggle {
  display: none;
}
.library-page {
  max-width: none;
  padding: 28px 32px 40px;
}
.library-count {
  margin: 0 0 18px;
}
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  align-items: stretch;
  gap: 20px;
}
.library-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  transition:
    border-color 120ms,
    box-shadow 120ms;
}
.library-card:hover,
.library-card:focus-within {
  border-color: var(--focus);
  box-shadow: 0 4px 18px #00000008;
}
.library-card h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.library-card-type {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.library-card-type .icon {
  flex: none;
  width: 19px;
  height: 19px;
}
.library-card-type span {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.library-card-open {
  text-align: left;
  color: inherit;
  font: inherit;
}
.library-card-open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
}
.library-card-open:focus-visible {
  outline: none;
}
.library-card-open:focus-visible::after {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.library-card-summary,
.library-card-comment {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: var(--body-size);
  line-height: var(--body-leading);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 3;
}
.library-card-summary {
  color: var(--muted);
  min-height: calc(var(--body-size) * var(--body-leading) * 3);
}
.library-card-comment {
  -webkit-line-clamp: 2;
}
.library-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.library-card-footer button {
  color: var(--ink);
}
.library-card .excerpt-tags {
  font-size: 14px;
  line-height: 1.6;
  gap: 6px 12px;
}
.library-card .excerpt-card-actions {
  gap: 8px;
}
.excerpt-card-actions button {
  position: relative;
  z-index: 1;
  font-size: 14px;
  padding: 6px 10px;
}
.library-empty {
  grid-column: 1 / -1;
}
@media (max-width: 1050px) and (min-width: 721px) {
  .shell.library-shell {
    grid-template-columns: 70px 220px minmax(0, 1fr);
  }
  .library-page {
    padding: 24px;
  }
}
@media (max-width: 720px) {
  .shell.library-shell {
    grid-template-columns: minmax(0, 1fr);
    position: relative;
  }
  .library-sidebar {
    display: none;
  }
  .library-nav-open .library-sidebar {
    display: flex;
    position: absolute;
    inset: 0 0 68px;
    z-index: 25;
    background: var(--subsurface);
  }
  button.library-close,
  #library-toggle {
    display: inline-flex;
  }
  .library-page {
    padding: 22px 18px;
  }
  .library-shell .topbar {
    height: auto;
    min-height: 92px;
    padding: 16px 18px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .library-shell .top-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .library-grid {
    gap: 16px;
  }
}

/* Document reading uses the user's requested 15px Song type, independently of chat. */
#modal:has(.document-detail) {
  padding: 0;
  width: min(820px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  height: min(780px, 85dvh);
  overflow: hidden;
}
#modal[open]:has(.document-detail) {
  display: flex;
  flex-direction: column;
}
#modal:has(.document-detail) .modal-head {
  flex: none;
  padding: 18px 24px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}
#modal:has(.document-detail) .modal-head h2 {
  font-size: 20px;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
#modal:has(.document-detail) .modal-body,
.document-detail {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  gap: 0;
}
.document-detail-scroll {
  overflow: auto;
  min-height: 0;
  flex: 1;
  padding: 24px 28px;
  overscroll-behavior: contain;
}
.document-preview {
  --body-size: 15px;
  --body-leading: 1.8;
  font-family: "Songti SC", "SimSun", "STSong", serif;
  font-size: 15px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
#modal
  .document-preview
  :is(p, li, blockquote, td, th, h1, h2, h3, h4, h5, h6, pre, code) {
  font-family: inherit;
  font-size: 15px;
  line-height: 1.8;
}
.document-preview h1,
.document-preview h2 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.35em;
}
.document-detail-actions {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.document-detail-actions button {
  flex: none;
  width: auto;
  min-height: 36px;
  padding: 7px 12px;
  font-size: 14px;
  line-height: 1.6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.document-detail-actions .document-download {
  background: var(--accent);
  color: var(--accent-ink);
}
.document-download .icon {
  width: 16px;
  height: 16px;
}
@media (max-width: 520px) {
  #modal:has(.document-detail) .modal-head {
    padding: 14px 16px;
  }
  .document-detail-scroll {
    padding: 20px 18px;
  }
  .document-detail-actions {
    padding: 10px 14px;
  }
  .document-detail-actions button {
    min-height: 44px;
  }
}
