:root {
  --workspace-accent: var(--chat-accent);
  --workspace-bg: var(--chat-surface);
  --workspace-muted: #65656b;
}
#workspace-panel {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px 64px;
  background: var(--workspace-bg);
}
.workspace-section {
  max-width: 960px;
  margin: 0 auto 32px;
}
.workspace-section h2 {
  font-size: 28px;
  letter-spacing: -0.6px;
  margin: 8px 0 16px;
}
.workspace-section > p {
  line-height: 1.6;
  margin-bottom: 24px;
}
.workspace-section .workspace-section {
  margin-top: 40px;
}
.workspace-section .workspace-section h2 {
  font-size: 22px;
}
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.service-card {
  padding: 24px;
  border-radius: 22px;
  background: var(--chat-surface);
  box-shadow: 0 4px 16px #00000005;
  margin-bottom: 16px;
}
.service-card h3 {
  margin: 12px 0;
  font-size: 22px;
}
.service-card p {
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.service-card button,
.workspace-section > button,
.workspace-row button {
  margin: 8px 8px 0 0;
}
.workspace-section button,
.interaction-card button {
  min-height: 44px;
  border-radius: 12px;
}
.workspace-section a {
  display: inline-block;
  padding: 12px 16px 12px 0;
  color: var(--workspace-accent);
}
.workspace-form {
  max-width: 600px;
  display: grid;
  gap: 16px;
  margin: 16px 0;
}
.workspace-form label {
  display: grid;
  gap: 8px;
  font-size: 15px;
}
.workspace-form input,
.workspace-form textarea,
.workspace-form select {
  width: 100%;
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--chat-line);
  border-radius: 12px;
  background: var(--chat-surface);
  color: var(--chat-ink);
  font: inherit;
}
.workspace-form textarea {
  min-height: 144px;
  resize: vertical;
}
.workspace-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--chat-line);
}
.workspace-row p {
  flex-basis: 100%;
}
.workspace-section details {
  background: var(--chat-surface);
  padding: 20px 24px;
  border-radius: 16px;
  margin: 16px 0;
}
.workspace-section summary {
  cursor: pointer;
  min-height: 28px;
  font-weight: 600;
}
.empty-state {
  padding: 40px 0;
  color: var(--workspace-muted);
}
.report-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.7;
}
.main:not([data-view="agent"]) > footer .composer,
.main:not([data-view="agent"]) > footer .disclaimer {
  display: none;
}
.main:not([data-view="agent"]) header #study-open,
.main:not([data-view="agent"]) header #assets-open,
.main:not([data-view="agent"]) header #plugins-open {
  display: none;
}
.interaction-card {
  background: var(--chat-surface);
  padding: 24px;
  border-radius: 22px;
  box-shadow: 0 8px 32px #00000014;
  border: 1px solid var(--chat-line);
  margin: 0 0 16px;
  max-height: 55vh;
  overflow-y: auto;
}
.interaction-card h3 {
  font-size: 20px;
  margin: 0 0 8px;
}
.interaction-card .workspace-form {
  margin-bottom: 0;
  grid-template-columns: 1fr 1fr;
}
.interaction-card .workspace-form > p {
  grid-column: 1 / -1;
}
.card-result {
  padding: 12px 16px;
  background: var(--chat-surface);
  border-radius: 12px;
}
.workspace-section :focus-visible,
.interaction-card :focus-visible {
  outline: 3px solid var(--chat-accent);
  outline-offset: 3px;
}
@media (max-width: 700px) {
  #workspace-panel {
    padding: 24px 16px;
  }
  .service-grid {
    grid-template-columns: 1fr;
  }
  .workspace-section h2 {
    font-size: 26px;
  }
  .interaction-card {
    padding: 16px;
  }
  .interaction-card .workspace-form {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .interaction-card {
    animation: none;
    transition: none;
  }
}

/* Application chrome: narrow global rail, contextual sidebar and content. */
body:has(#app:not([hidden])) {
  overflow: hidden;
}
body:has(#app:not([hidden])) > .legal {
  display: none;
}
#app {
  --accent: var(--chat-accent);
  --line: #303030;
  --muted: #969696;
  --workspace-muted: #969696;
  --workspace-bg: var(--chat-surface);
  --workspace-accent: var(--chat-accent);
  color: var(--chat-ink);
  background: var(--chat-surface);
  flex-direction: row;
  height: 100dvh;
  padding: 8px 8px 8px 0;
  gap: 0;
  color-scheme: dark;
}
.app-rail {
  width: 48px;
  flex: 0 0 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px 5px;
  overflow: visible;
}
.app-rail > button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 9px;
  padding: 8px;
  color: var(--chat-muted);
}
.app-rail > button:hover,
.app-rail > button[aria-current="page"] {
  background: var(--chat-surface);
  color: var(--chat-ink);
}
.app-rail svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}
#account-toggle {
  margin-top: auto;
  padding: 2px;
}
#avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
  background: var(--chat-surface);
  color: var(--chat-ink);
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.workspace-shell {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--chat-surface);
}
#sidebar {
  width: 246px;
  flex: 0 0 246px;
  background: var(--chat-surface);
  border-right: 1px solid var(--chat-line);
  padding: 16px 12px;
  min-height: 0;
}
#sidebar .side-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
  padding: 0 8px;
  min-height: 24px;
  font-size: 15px;
}
#chat-sidebar {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
#module-menu {
  flex: 1;
}
#module-menu button,
#new-chat,
#chats button {
  min-height: 36px;
  padding: 8px 10px;
  margin-bottom: 4px;
  text-align: left;
  border-radius: 7px;
  font-size: 13px;
  background: transparent;
  color: var(--chat-muted);
}
#module-menu button:hover,
#module-menu button[aria-current="page"],
#chats button:hover,
#new-chat:hover {
  background: var(--chat-surface);
  color: var(--chat-ink);
}
.history-label {
  padding-left: 10px;
  font-size: 11px;
  color: var(--chat-muted);
  letter-spacing: 0;
}
.main {
  background: var(--chat-surface);
  min-width: 0;
}
.main > header {
  height: 52px;
  min-height: 52px;
  border: 0;
  background: transparent;
  padding: 12px 24px;
}
.main > header h2 {
  color: var(--chat-muted);
  font-size: 14px;
  font-weight: 500;
}
.main .model {
  display: none;
}
.main:not([data-view="agent"]) > header {
  display: none;
}
.main:not([data-view="agent"]) > footer {
  display: none;
}
#workspace-panel {
  padding: 64px 40px;
}
.workspace-section {
  max-width: 780px;
}
.workspace-section h2 {
  font-size: 23px;
  letter-spacing: 0;
  margin-bottom: 12px;
}
.workspace-section .workspace-section h2 {
  font-size: 15px;
}
.workspace-section .muted {
  color: var(--chat-muted);
  font-size: 13px;
}
.service-card,
.workspace-section details {
  background: var(--chat-surface);
  border: 1px solid var(--chat-line);
  border-radius: 12px;
  box-shadow: none;
  padding: 20px;
}
.service-card h3 {
  font-size: 17px;
}
.workspace-row {
  border-color: var(--chat-line);
}
.workspace-section button,
.interaction-card button {
  border-radius: 8px;
  min-height: 36px;
  background: var(--chat-surface);
  padding: 8px 12px;
  font-size: 13px;
}
#app .primary {
  color: var(--chat-ink);
  background: var(--chat-surface);
}
.workspace-form {
  max-width: 600px;
}
.workspace-form label {
  font-size: 13px;
}
.workspace-form input,
.workspace-form textarea,
.workspace-form select {
  background: var(--chat-surface);
  color: var(--chat-ink);
  border-color: var(--chat-line);
  border-radius: 8px;
  font-size: 14px;
  margin: 0;
}
.main[data-view="personal"] .workspace-section {
  max-width: 640px;
}
.main[data-view="personal"] .workspace-section .workspace-section {
  padding: 24px;
  background: var(--chat-surface);
  border: 1px solid var(--chat-line);
  border-radius: 12px;
}
#conversation {
  background: var(--chat-surface);
}
.welcome {
  color: var(--chat-ink);
}
.welcome .brand-mark {
  display: none;
}
.welcome h1 {
  font-size: 28px;
  font-weight: 600;
}
.welcome p {
  color: var(--chat-muted);
}
.suggestions button {
  background: transparent;
  border: 1px solid var(--chat-line);
  color: var(--chat-muted);
  box-shadow: none;
  border-radius: 12px;
}
.main > footer {
  background: var(--chat-surface);
  border: 0;
}
.composer {
  background: var(--chat-surface);
  border: 1px solid var(--chat-line);
  box-shadow: none;
  border-radius: 20px;
}
#prompt {
  color: var(--chat-ink);
  background: transparent;
}
#send {
  background: var(--chat-surface);
  color: var(--chat-ink);
}
.interaction-card {
  background: var(--chat-surface);
  border-color: var(--chat-line);
  border-radius: 14px;
  box-shadow: none;
}
.card-result {
  background: var(--chat-surface);
}
.account-popover {
  position: fixed;
  left: 12px;
  bottom: 50px;
  width: 250px;
  z-index: 100;
  background: var(--chat-surface);
  color: var(--chat-ink);
  border: 1px solid var(--chat-line);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 12px 40px #0008;
}
.account-identity {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-bottom: 1px solid var(--chat-line);
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}
.account-popover button {
  width: 100%;
  display: flex;
  gap: 12px;
  padding: 11px 12px;
  text-align: left;
  border-radius: 7px;
  font-size: 13px;
}
.account-popover button:hover {
  background: var(--chat-surface);
}
#app :focus-visible {
  outline: 2px solid var(--chat-accent);
  outline-offset: 2px;
}
@media (max-width: 700px) {
  #app {
    padding: 0;
  }
  .app-rail {
    width: 44px;
    flex-basis: 44px;
    padding-top: 12px;
  }
  .workspace-shell {
    border-radius: 0;
  }
  #sidebar {
    top: 0;
    left: 44px;
    height: 100dvh;
    width: min(246px, calc(100vw - 44px));
    z-index: 30;
  }
  #workspace-panel {
    padding: 64px 20px 24px;
  }
  .main:not([data-view="agent"]) > header {
    display: flex;
    position: absolute;
    top: 0;
    left: 44px;
    height: 48px;
  }
  .main:not([data-view="agent"]) > header .heading,
  .main:not([data-view="agent"]) #wechat-open,
  .main:not([data-view="agent"]) #mobile-new {
    display: none;
  }
  .service-grid {
    grid-template-columns: 1fr;
  }
  .welcome h1 {
    font-size: 22px;
  }
}

#app .message.user .text {
  background: var(--chat-surface);
  color: var(--chat-ink);
}
#app .message pre,
#app .message code {
  background: var(--chat-surface);
  color: var(--chat-ink);
}
#app .message a {
  color: var(--chat-accent);
}
#app .message .label {
  color: var(--chat-muted);
}
body:has(#app:not([hidden])) dialog {
  color-scheme: dark;
  background: var(--chat-surface);
  color: var(--chat-ink);
  border: 1px solid var(--chat-line);
}
body:has(#app:not([hidden])) dialog input {
  background: var(--chat-surface);
  color: var(--chat-ink);
  border-color: var(--chat-line);
}
body:has(#app:not([hidden])) dialog .primary {
  background: var(--chat-surface);
  color: var(--chat-ink);
}
body:has(#app:not([hidden])) .workspace-bar {
  background: var(--chat-surface);
  border-color: var(--chat-line);
}

.main[data-view="spaces"] #workspace-panel {
  padding: 36px 40px;
}
.content-library {
  max-width: 1280px;
  margin: 0 auto;
}
.library-toolbar,
.library-controls,
.reader-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.library-toolbar h1 {
  font-size: 25px;
  font-weight: 600;
  margin: 0 auto 0 0;
}
.library-toolbar button,
.library-upload {
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--chat-surface);
  color: var(--chat-ink);
  font-size: 13px;
  white-space: nowrap;
}
.library-upload {
  background: var(--chat-surface);
  color: var(--chat-ink);
  border: 1px solid var(--chat-line);
  position: relative;
  cursor: pointer;
}
.library-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  cursor: pointer;
}
.library-controls {
  margin-top: 32px;
  border-bottom: 1px solid var(--chat-line);
  padding-bottom: 18px;
}
.library-controls input {
  max-width: 420px;
  flex: 1;
}
.library-controls input,
.library-controls select {
  background: var(--chat-surface);
  color: var(--chat-ink);
  border: 1px solid var(--chat-line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
  font: inherit;
  font-size: 13px;
}
.library-controls button {
  margin-left: auto;
  color: var(--chat-muted);
  font-size: 13px;
}
.library-item {
  display: flex;
  border-bottom: 1px solid var(--chat-line);
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
}
.library-item:hover {
  background: var(--chat-surface);
  border-radius: 8px;
}
.library-open {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 16px;
  padding: 12px 0;
  text-align: left;
}
.library-open strong {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-symbol {
  width: 36px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--chat-surface);
  color: var(--chat-accent);
  font-size: 12px;
  border: 1px solid var(--chat-line);
}
.file-symbol.sheet {
  background: var(--chat-surface);
  color: var(--ui-success);
  border-color: var(--chat-line);
}
.file-symbol.slides {
  background: var(--chat-surface);
  color: var(--chat-muted);
  border-color: var(--chat-line);
}
.file-symbol.pdf {
  background: var(--chat-surface);
  color: var(--ui-danger);
  border-color: var(--chat-line);
}
.library-items.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.library-items.grid .library-item {
  border: 1px solid var(--chat-line);
  border-radius: 12px;
  background: var(--chat-surface);
  align-items: flex-start;
}
.library-items.grid .library-open {
  flex-direction: column;
  align-items: flex-start;
  min-height: 160px;
}
.library-empty {
  text-align: center;
  padding: 100px 20px;
  grid-column: 1/-1;
}
.library-empty h2 {
  font-size: 20px;
  font-weight: 500;
}
.empty-icon {
  display: block;
  font-size: 46px;
  color: var(--chat-muted);
}
.main[data-view="spaces"] #workspace-panel:has(.content-reader) {
  padding: 16px 24px 24px;
}
.content-reader {
  --reader-line: #ffffff12;
  --reader-surface: var(--chat-surface);
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
.reader-toolbar {
  min-height: 60px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--reader-line);
  gap: 8px;
}
.reader-toolbar strong {
  flex: 1;
  min-width: 80px;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reader-toolbar button,
.reader-toolbar a,
.reader-toolbar summary {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--chat-muted);
  cursor: pointer;
  min-height: 36px;
}
.reader-toolbar button:hover,
.reader-toolbar a:hover,
.reader-toolbar summary:hover {
  background: var(--ui-hover);
  color: var(--chat-ink);
}
.reader-toolbar .reader-chat-action {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
  background: var(--chat-surface);
  color: var(--chat-ink);
  font-weight: 500;
}
.reader-toolbar .reader-chat-action:hover {
  background: var(--chat-surface);
  color: var(--chat-ink);
}
.reader-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.reader-body {
  width: 100%;
  min-width: 0;
  overflow: auto;
  padding: 24px 0;
}
.reader-body .workspace-form {
  max-width: 900px;
  margin: 0 auto;
}
.reader-body textarea {
  min-height: 55vh;
  line-height: 1.8;
}
.reader-body iframe {
  border: 0;
  width: 100%;
  height: 70vh;
  background: var(--chat-surface);
}
.reader-organize {
  position: relative;
}
.reader-organize summary {
  list-style: none;
}
.reader-organize-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  width: 240px;
  padding: 16px;
  border-radius: 12px;
  background: var(--chat-surface);
  border: 1px solid var(--chat-line);
  box-shadow: 0 12px 32px #0005;
  display: grid;
  gap: 12px;
}
.reader-organize-menu label {
  font-size: 13px;
  color: var(--chat-muted);
}
.reader-organize-menu select {
  width: 100%;
  padding: 8px;
  background: var(--chat-surface);
  color: var(--chat-ink);
  border: 1px solid var(--chat-line);
  border-radius: 8px;
}
.reader-organize-menu button {
  background: var(--chat-surface);
}
.reader-organize-menu p:empty {
  display: none;
}
.content-reader :focus-visible {
  outline: 2px solid var(--chat-accent);
  outline-offset: 3px;
}
@media (max-width: 700px) {
  .main[data-view="spaces"] #workspace-panel:has(.content-reader) {
    padding: 56px 12px 12px;
  }
  .reader-toolbar {
    flex-wrap: wrap;
  }
  .reader-toolbar strong {
    flex-basis: calc(100% - 100px);
  }
  .reader-toolbar .reader-chat-action {
    margin-left: auto;
  }
  .reader-toolbar button,
  .reader-toolbar summary,
  .reader-toolbar a {
    min-height: 44px;
  }
}
@media (max-width: 700px) {
  .main[data-view="spaces"] #workspace-panel {
    padding: 64px 16px 20px;
  }
  .library-toolbar {
    flex-wrap: wrap;
  }
  .library-toolbar h1 {
    width: 100%;
    margin-bottom: 12px;
  }
  .library-controls {
    flex-wrap: wrap;
  }
  .library-controls input {
    width: 100%;
    flex-basis: 100%;
  }
  .library-open .muted {
    display: none;
  }
}

.document-page {
  max-width: 760px;
  margin: 16px auto 64px;
  padding: 16px 32px 40px;
  line-height: 1.85;
  font-size: 15px;
  color: var(--chat-muted);
}
.document-page h1 {
  font-size: 28px;
  line-height: 1.4;
  margin: 0 0 28px;
  font-weight: 600;
  color: var(--chat-ink);
}
.document-page h2 {
  font-size: 21px;
  margin: 32px 0 12px;
  font-weight: 600;
  color: var(--chat-ink);
}
.document-page h3,
.document-page h4 {
  font-size: 17px;
  margin: 24px 0 8px;
  color: var(--chat-ink);
}
.document-page p {
  margin: 12px 0;
  white-space: pre-wrap;
}
.document-page ul,
.document-page ol {
  padding-left: 24px;
  margin: 12px 0 24px;
}
.document-page li {
  margin: 6px 0;
}
.document-page li::marker {
  color: var(--chat-muted);
}
.document-page blockquote {
  margin: 20px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--chat-line);
  color: var(--chat-muted);
}
.document-page code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9em;
  background: var(--ui-hover);
  border-radius: 4px;
  padding: 2px 4px;
}
.document-page pre {
  background: var(--chat-surface);
  padding: 20px;
  border-radius: 10px;
  overflow: auto;
  line-height: 1.65;
}
.document-page pre code {
  background: none;
  padding: 0;
}
.document-page hr {
  border: 0;
  border-top: 1px solid var(--chat-line);
  margin: 28px 0;
}
.markdown-table {
  overflow: auto;
}
.markdown-table table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
.markdown-table td,
.markdown-table th {
  border-bottom: 1px solid var(--chat-line);
  text-align: left;
  padding: 10px 16px;
}
.reader-body .workspace-form > label {
  font-weight: 400;
}
.reader-body .workspace-form > button {
  justify-self: start;
  min-width: 100px;
  padding: 10px 18px;
}
@media (max-width: 700px) {
  .document-page {
    padding: 24px 20px;
  }
}

.preview-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
.preview-table td,
.preview-table th {
  padding: 12px 16px;
  border: 1px solid var(--chat-line);
  text-align: left;
  white-space: pre-wrap;
}
.preview-table th {
  background: var(--chat-surface);
  font-weight: 500;
}

.reader-body.spreadsheet-reader {
  display: flex;
  flex-direction: column;
  padding: 16px 0 0;
  overflow: hidden;
}
.sheet-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 0 16px;
}
.sheet-controls select {
  max-width: 240px;
  background: var(--chat-surface);
  color: var(--chat-ink);
  border: 1px solid var(--reader-line);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
}
.reader-badge {
  font-size: 11px;
  color: var(--chat-muted);
  border: 1px solid var(--chat-line);
  border-radius: 4px;
  padding: 2px 6px;
}
.sheet-info {
  margin-left: auto;
  position: relative;
  color: var(--chat-muted);
  font-size: 12px;
}
.sheet-info summary {
  cursor: pointer;
  padding: 8px;
  list-style: none;
}
.sheet-info p {
  position: absolute;
  z-index: 5;
  right: 0;
  top: 28px;
  width: 280px;
  padding: 16px;
  background: var(--chat-surface);
  border: 1px solid var(--chat-line);
  border-radius: 10px;
  line-height: 1.7;
  box-shadow: 0 8px 24px #0005;
}
.sheet-viewport {
  flex: 1;
  min-height: 160px;
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--reader-line);
  border-radius: 8px;
  scrollbar-color: var(--chat-line) var(--chat-line);
  scrollbar-width: thin;
}
.sheet-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.sheet-table td,
.sheet-table th {
  min-width: 112px;
  max-width: 240px;
  padding: 7px 12px;
  height: 32px;
  line-height: 18px;
  border: 0;
  border-right: 1px solid var(--chat-line);
  border-bottom: 1px solid var(--chat-line);
  overflow-wrap: anywhere;
  font-weight: 400;
  color: var(--chat-muted);
}
.sheet-table tr:nth-child(odd) td {
  background: var(--ui-hover);
}
.sheet-table tr:hover td {
  background: var(--ui-hover);
}
.sheet-table tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--chat-surface);
  color: var(--chat-muted);
  text-align: center;
}
.sheet-table tr th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 48px;
  background: var(--chat-surface);
  color: var(--chat-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.sheet-table tr:first-child th:first-child {
  z-index: 3;
}
.sheet-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
}
.sheet-footer > p {
  font-size: 12px;
  margin: 0;
  color: var(--chat-muted);
}
.sheet-paging,
.sheet-page-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sheet-paging {
  gap: 16px;
  flex-shrink: 0;
}
.sheet-page-group > span {
  font-size: 12px;
  margin-right: 4px;
}
.sheet-page-group button {
  background: var(--chat-surface);
  border: 1px solid var(--chat-line);
  border-radius: 6px;
  color: var(--chat-ink);
  width: 32px;
  height: 32px;
  font-size: 21px;
  line-height: 1;
}
.sheet-page-group button:disabled {
  opacity: 0.3;
  cursor: default;
}
.sheet-page-group button:not(:disabled):hover {
  background: var(--chat-surface);
}
@media (max-width: 700px) {
  .sheet-footer {
    flex-wrap: wrap;
    gap: 8px;
  }
  .sheet-paging {
    margin-left: auto;
  }
  .sheet-page-group button {
    width: 44px;
    height: 44px;
  }
  .sheet-controls select {
    max-width: 160px;
  }
}
.image-stage {
  overflow: auto;
  max-height: 70vh;
  margin-top: 16px;
  background: var(--chat-surface);
  border: 1px solid var(--chat-line);
}
.file-image {
  display: block;
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  margin: auto;
}
.file-image.original {
  max-width: none;
  max-height: none;
}

.source-reader {
  border: 1px solid var(--chat-line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--chat-surface);
}
.source-header,
.file-mode-controls,
.pdf-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--chat-muted);
}
.source-header {
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--chat-line);
}
.source-header label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 0;
}
.source-header input {
  width: auto;
  margin: 0;
  accent-color: var(--chat-accent);
}
.source-code {
  margin: 0;
  padding: 24px;
  overflow: auto;
  font:
    13px/1.8 ui-monospace,
    Consolas,
    monospace;
  color: var(--chat-ink);
  tab-size: 2;
}
.source-code.wrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.preview-notice {
  color: var(--chat-muted);
  font-size: 13px;
  padding: 12px 0;
}
.file-mode-controls {
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.file-mode-controls button,
.pdf-controls button,
.pdf-controls select,
.pdf-controls input {
  border: 1px solid var(--chat-line);
  background: var(--chat-surface);
  color: var(--chat-ink);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  width: auto;
  margin: 0;
}
.pdf-controls input {
  width: 64px;
}
.pdf-controls button:disabled {
  opacity: 0.35;
}
.pdf-controls select {
  margin-left: auto;
}
.reader-body.pdf-reader {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 0 0;
}
.pdf-controls {
  flex-wrap: wrap;
  padding: 0 0 16px;
  flex-shrink: 0;
}
.pdf-stage {
  overflow: auto;
  flex: 1;
  min-height: 200px;
  padding: 24px;
  border-radius: 10px;
  background: var(--chat-surface);
  text-align: center;
  scrollbar-color: var(--chat-line) var(--chat-line);
}
.pdf-stage > img {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  margin: 0 auto;
  box-shadow: 0 4px 24px #0004;
}
.pdf-stage.actual > img {
  width: auto;
  max-width: none;
}
.pdf-stage .source-reader {
  text-align: left;
}
.pdf-stage[aria-busy] {
  opacity: 0.5;
}
.html-stage iframe {
  display: block;
  border-radius: 8px;
}
@media (max-width: 700px) {
  .pdf-stage {
    padding: 8px;
  }
  .document-page {
    margin: 0 auto;
    padding: 16px 8px;
  }
  .source-code {
    padding: 16px;
  }
}
.library-controls button + button {
  margin-left: 0;
}
.library-selection-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 16px 0;
  border: 1px solid var(--chat-line);
  border-radius: 10px;
  background: var(--chat-surface);
  font-size: 13px;
}
.library-selection-bar[hidden] {
  display: none;
}
.library-selection-bar label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin: 0;
}
.library-selection-bar input,
.library-select {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 16px;
  accent-color: var(--chat-accent);
}
.library-selection-bar > span {
  color: var(--chat-muted);
  margin-right: auto;
}
.library-selection-bar button {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--chat-surface);
  font-size: 13px;
}
.library-selection-bar button:disabled {
  opacity: 0.35;
}
.library-item.selected {
  background: var(--ui-hover);
  border-radius: 8px;
}
.library-items.grid .library-select {
  margin-top: 16px;
}
@media (max-width: 700px) {
  .library-selection-bar {
    flex-wrap: wrap;
  }
}
/* Keep attachment cards and the editable draft in separate, predictable rows. */
.composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}
.composer .attachments:empty {
  display: none;
}
.composer .attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 144px;
  overflow-y: auto;
}
.composer .attachments .chip {
  margin: 0;
  min-width: 0;
  max-width: min(100%, 260px);
  padding: 6px 8px 6px 12px;
  background: var(--chat-surface);
  color: var(--chat-ink);
  border: 1px solid var(--chat-line);
  border-radius: 10px;
}
.composer .chip > span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.composer .chip button {
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--chat-muted);
  border-radius: 6px;
}
.composer .chip button:hover {
  background: var(--chat-surface);
  color: var(--chat-ink);
}
#app .composer #prompt {
  field-sizing: content;
  box-sizing: border-box;
  min-height: 52px;
  max-height: 160px;
  margin: 0;
  padding: 12px 6px;
  line-height: 1.6;
  border: 0;
  outline: none;
  box-shadow: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--chat-line) transparent;
}
.composer:focus-within {
  border-color: var(--chat-line);
}

/* Chat operations and drop feedback follow the workspace chrome, not the OS theme. */
.chat-actions {
  background: var(--chat-surface);
  color: var(--chat-ink);
  border-color: var(--chat-line);
  color-scheme: dark;
}
.chat-actions p {
  color: var(--chat-muted);
  border-color: var(--chat-line);
}
.chat-actions .danger-action {
  color: var(--ui-danger);
}
.chat-actions button:hover,
.chat-actions button:focus-visible {
  background: var(--chat-surface);
}
#app .drop-hint {
  background: var(--chat-surface);
  color: var(--chat-ink);
}
#app .composer.file-dragging {
  outline-color: #82bc9e;
}
#app #attachments .attachment-card {
  background: var(--chat-surface);
  border-color: var(--chat-line);
}
#app #attachments .attachment-name {
  background: var(--chat-surface);
  border-radius: 0 0 11px 11px;
}
#attachment-dialog {
  background: var(--chat-surface);
  color: var(--chat-ink);
  border-color: var(--chat-line);
  color-scheme: dark;
}
#attachment-dialog a {
  color: var(--chat-accent);
}
.operation-preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border, var(--chat-line));
  border-radius: 8px;
}

.interaction-card:has(.write-review) {
  max-height: none;
  overflow: visible;
}
.write-review {
  margin-block: 12px;
}
.write-review-content {
  max-height: 26vh;
  overflow: auto;
}
.write-review summary {
  cursor: pointer;
  min-height: 44px;
  display: list-item;
  padding: 10px;
}
.write-review input {
  width: 100%;
  min-height: 44px;
}
.write-review table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.write-review th,
.write-review td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--border, var(--chat-line));
  vertical-align: top;
}
.write-review pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 46ch;
  font: inherit;
}
.write-review button {
  min-height: 44px;
  margin: 8px;
}

.main {
  position: relative;
}
.conversation-map {
  position: absolute;
  right: 6px;
  top: 20%;
  max-height: 45%;
  overflow-y: auto;
  scrollbar-width: thin;
  z-index: 3;
}
.conversation-map[hidden] {
  display: none;
}
.conversation-map button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  padding: 0;
}
.conversation-map button span {
  width: 16px;
  height: 3px;
  border-radius: 3px;
  background: var(--chat-muted);
}
.conversation-map button[aria-current] span {
  width: 24px;
  background: var(--chat-accent);
}
.conversation-map button:hover,
.conversation-map button:focus-visible {
  background: var(--chat-surface);
  border-radius: 10px;
}
@media (max-width: 760px) {
  .conversation-map {
    right: 0;
    background: color-mix(in srgb, var(--chat-bg) 90%, transparent);
    border-radius: 12px;
    max-height: 28%;
  }
}

.interaction-card:has(.write-review) .workspace-form {
  position: static;
  padding-block: 10px;
  background: inherit;
  z-index: 1;
}
.interaction-card:has(.write-review) .workspace-form [role="status"]:empty {
  display: none;
}
.interaction-card:has(.write-review) .workspace-form button:not([type="submit"]) {
  background: transparent;
  color: inherit;
  border: 1px solid var(--chat-line);
}
#interaction-cards {
  max-height: 45dvh;
  overflow-y: auto;
  min-height: 0;
}
.main > footer:has(.interaction-card) {
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  flex-shrink: 0;
}
