:root {
  color-scheme: light;
  --bg: #fafafa;
  --panel: #ffffff;
  --sidebar: #f4f4f3;
  --surface: #f1f1ef;
  --fg: #272725;
  --muted: #686864;
  --border: #e5e5e2;
  --hover: #eaeae7;
  --brand: #eb5a33;
  --primary: #272725;
  --primary-fg: #ffffff;
  --selected: #e8e8e4;
  --success: #276749;
  --success-bg: #edf5ef;
  --danger: #b52f32;
  --danger-bg: #fff1f1;
  --text-ui-xl: 24px;
  --text-ui-lg: 18px;
  --text-ui-base: 14px;
  --text-ui-caption: 13px;
  --text-ui-sm: 12px;
  --text-mobile-input-safe: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--text-ui-base);
  line-height: 1.5;
  background: var(--bg);
  color: var(--fg);
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: var(--text-ui-xl);
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
h2 {
  font-size: var(--text-ui-lg);
  font-weight: 600;
  margin-bottom: 16px;
}
h3 {
  font-size: var(--text-ui-base);
  font-weight: 600;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin: 24px 0 16px;
}
p {
  color: var(--muted);
  line-height: 1.7;
}
button,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}
button,
input,
select {
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--fg);
}
button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  transition:
    background 0.12s,
    border-color 0.12s;
}
button:hover {
  background: var(--hover);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
button.primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
button.primary:hover {
  opacity: 0.88;
}
input,
select {
  width: 100%;
  min-width: 0;
  height: 40px;
}
input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  font-size: var(--text-ui-caption);
  font-weight: 500;
}
.check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  margin: 0;
}
.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand img {
  display: block;
  flex-shrink: 0;
}
.brand strong {
  display: block;
  font-size: var(--text-ui-lg);
  letter-spacing: 0.3px;
  line-height: 1.2;
}
.brand span {
  display: block;
  margin-top: 4px;
  font-size: var(--text-ui-sm);
  color: var(--muted);
}
.brand-login {
  flex-direction: column;
  gap: 16px;
}
.brand-login img {
  width: 64px;
  height: 64px;
}
.brand-login strong {
  font-size: var(--text-ui-xl);
}
.login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 48px 24px;
}
.login-content {
  width: 320px;
  max-width: 100%;
}
.login-content > h1 {
  text-align: center;
  font-size: var(--text-ui-lg);
  margin-top: 32px;
}
.login-description {
  text-align: center;
  font-size: var(--text-ui-caption);
  margin-bottom: 32px;
}
.login .primary {
  width: 100%;
  margin-top: 4px;
}
.login .settings-form {
  border: 0;
  padding: 0;
  background: transparent;
}
.login .settings-form h2 {
  font-size: var(--text-ui-base);
}
.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  padding: 28px 16px 16px;
  background: var(--sidebar);
}
.sidebar .brand {
  padding: 0 12px;
}
.nav-label {
  color: var(--muted);
  font-size: var(--text-ui-sm);
  padding: 0 12px;
  margin: 40px 0 12px;
}
nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
nav button {
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
  padding: 11px 12px;
  color: var(--muted);
}
nav button .icon {
  opacity: 0.85;
}
nav button.selected {
  background: var(--selected);
  color: var(--fg);
}
nav button.selected .icon {
  color: var(--brand);
  opacity: 1;
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 24px;
}
.account-menu {
  position: relative;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.account-menu summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
}
.account-menu summary::-webkit-details-marker {
  display: none;
}
.account-menu summary:hover,
.account-menu[open] summary {
  background: var(--selected);
}
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  font-weight: 600;
}
.account-name {
  min-width: 0;
  flex: 1;
}
.account-name strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-ui-caption);
  font-weight: 500;
}
.account-name small {
  display: block;
  font-size: var(--text-ui-sm);
  color: var(--muted);
}
.account-actions {
  position: absolute;
  z-index: 10;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  background: var(--panel);
  box-shadow: 0 6px 20px #00000014;
}
.account-actions p {
  margin: 0 4px 4px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-ui-sm);
  overflow-wrap: anywhere;
}
.account-actions button {
  justify-content: flex-start;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 6px;
}
.account-actions button:hover {
  background: var(--hover);
}
.workspace {
  padding: 28px 40px 48px;
  min-width: 0;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: var(--text-ui-sm);
  margin-bottom: 32px;
}
.breadcrumb span {
  opacity: 0.5;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}
.page-heading p {
  margin: 0;
  font-size: var(--text-ui-caption);
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.summary-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  background: var(--panel);
}
.summary-card span {
  color: var(--muted);
  font-size: var(--text-ui-caption);
}
.summary-card strong {
  display: block;
  font-size: var(--text-ui-xl);
  font-weight: 600;
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-heading h2 {
  font-size: var(--text-ui-base);
  margin: 0;
}
.section-heading span,
.table-description {
  color: var(--muted);
  font-size: var(--text-ui-caption);
}
.info-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  background: var(--surface);
  border-radius: 12px;
  color: var(--muted);
  font-size: var(--text-ui-caption);
  margin-bottom: 28px;
}
.info-note .icon {
  color: var(--fg);
  margin-top: 1px;
}
.table {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
th {
  color: var(--muted);
  font-size: var(--text-ui-sm);
  font-weight: 500;
  background: var(--surface);
}
td {
  font-size: var(--text-ui-caption);
}
td strong {
  font-weight: 500;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
td button {
  padding: 5px 8px;
  border: 0;
  background: transparent;
  font-size: var(--text-ui-caption);
  margin-right: 4px;
}
.cell-secondary {
  display: block;
  font-size: var(--text-ui-sm);
  color: var(--muted);
  margin-top: 4px;
}
.protocol {
  font-size: var(--text-ui-sm);
  color: var(--muted);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: var(--text-ui-sm);
  font-weight: 500;
  white-space: nowrap;
}
.status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.status-active {
  background: var(--success-bg);
  color: var(--success);
}
.status-muted {
  background: var(--surface);
  color: var(--muted);
}
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.danger {
  color: var(--danger);
}
.error,
.notice {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: var(--text-ui-caption);
  overflow-wrap: anywhere;
}
.error {
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
}
.notice {
  color: var(--success);
  background: var(--success-bg);
}
.settings-form {
  max-width: 640px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  background: var(--panel);
}
.form-description,
.field-hint {
  color: var(--muted);
  font-size: var(--text-ui-caption);
  margin-bottom: 24px;
}
.field-hint {
  margin-top: -4px;
  font-size: var(--text-ui-sm);
}
.service-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.service-heading h2 {
  margin: 0;
}
.service-heading p {
  margin: 4px 0 0;
  font-size: var(--text-ui-caption);
}
.service-heading .status {
  margin-left: auto;
}
.service-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.service-icon .icon {
  width: 24px;
  height: 24px;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.toolbar label {
  margin-bottom: 0;
  width: 200px;
}
.editor-dialog {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  background: var(--panel);
  color: var(--fg);
  overflow-y: auto;
  box-shadow: 0 24px 80px #0003;
}
/* 字段内提示不是独立段落，避免叠加段落与字段的下边距。 */
.editor-dialog label {
  margin-bottom: 16px;
}
.editor-dialog label > .field-hint {
  margin: 0;
  font-weight: 400;
}
.editor-dialog {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.editor-dialog:hover {
  scrollbar-color: var(--muted) transparent;
}
.editor-dialog::-webkit-scrollbar {
  width: 6px;
}
.editor-dialog::-webkit-scrollbar-track {
  background: transparent;
}
.editor-dialog::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--border);
}
.editor-dialog::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}
.editor-dialog::backdrop {
  background: #0006;
  backdrop-filter: blur(2px);
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.dialog-heading h2 {
  margin: 0;
}
.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 8px;
}
.editor-dialog form > h3:first-child {
  padding-top: 0;
  border-top: 0;
  margin-top: 0;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 20px;
  margin-top: 24px;
  border-top: 1px solid var(--border);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #171716;
    --panel: #20201f;
    --sidebar: #1d1d1b;
    --surface: #262624;
    --fg: #e8e8e4;
    --muted: #a3a39c;
    --border: #353531;
    --hover: #33332f;
    --selected: #30302c;
    --primary: #efefea;
    --primary-fg: #20201e;
    --success: #94cfaa;
    --success-bg: #23342b;
    --danger: #ffaaaa;
    --danger-bg: #3d2323;
  }
}
@media (max-width: 1100px) {
  .workspace {
    padding: 24px;
  }
  .summary-card {
    padding: 20px;
  }
}
@media (max-width: 720px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: relative;
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 16px;
    gap: 16px;
  }
  .sidebar .brand {
    padding: 0;
  }
  .nav-label {
    display: none;
  }
  nav {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
  }
  nav button {
    flex-shrink: 0;
    padding: 9px 10px;
    font-size: var(--text-ui-caption);
  }
  .sidebar-bottom {
    grid-column: 2;
    grid-row: 1;
    padding: 0;
    margin: 0;
    align-self: center;
  }
  .account-menu {
    padding: 0;
    border: 0;
  }
  .account-menu summary {
    padding: 0;
  }
  .account-name,
  .account-menu summary > .icon {
    display: none;
  }
  .account-actions {
    bottom: auto;
    top: calc(100% + 12px);
    left: auto;
    right: 0;
    width: 220px;
  }
  .workspace {
    padding: 24px 16px;
  }
  .breadcrumb {
    display: none;
  }
  .page-heading {
    align-items: flex-start;
    margin-bottom: 24px;
  }
  .page-heading h1 {
    font-size: var(--text-ui-lg);
  }
  .page-heading p {
    max-width: 30ch;
  }
  .page-heading > button {
    padding: 8px 10px;
    font-size: var(--text-ui-caption);
  }
  .summary-grid {
    gap: 8px;
    margin-bottom: 24px;
  }
  .summary-card {
    padding: 12px;
  }
  .summary-card span {
    font-size: var(--text-ui-sm);
  }
  .summary-card strong {
    font-size: var(--text-ui-lg);
    overflow-wrap: anywhere;
  }
  .section-heading {
    align-items: flex-start;
  }
  .section-heading span {
    font-size: var(--text-ui-sm);
    max-width: 24ch;
    text-align: right;
  }
  .settings-form {
    padding: 20px;
  }
  .service-heading .status {
    margin-left: 0;
  }
  .editor-dialog {
    padding: 20px;
    max-height: calc(100dvh - 32px);
  }
  input,
  select {
    font-size: var(--text-mobile-input-safe); /* 防止移动端编辑表单时自动缩放。 */
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

.provider-picker {
  display: grid;
  gap: 16px;
}
.provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.provider-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  text-align: left;
  min-width: 0;
}
.provider-card > span:last-child {
  overflow-wrap: anywhere;
}
.provider-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}
.custom-logo {
  display: grid;
  place-items: center;
  background: var(--surface);
  font-size: var(--text-ui-xl);
}
.model-fields {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
  min-width: 0;
}
.selected-provider {
  display: flex;
  align-items: center;
  gap: 12px;
}
.selected-provider > div {
  flex: 1;
}
.selected-provider p {
  margin: 4px 0 0;
}
.key-link {
  font-size: var(--text-ui-caption);
  color: var(--muted);
  margin-top: -8px;
}
.model-advanced {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.model-advanced summary {
  cursor: pointer;
  font-weight: 500;
}
.model-advanced > label,
.model-capacities {
  margin-top: 14px;
}
.model-capacities {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 560px) {
  .provider-grid,
  .model-capacities {
    grid-template-columns: 1fr;
  }
}

.feishu-setup {
  margin-bottom: 24px;
}
.setup-steps {
  padding-left: 22px;
  margin: 0 0 20px;
}
.setup-steps li {
  padding-left: 6px;
  margin-bottom: 22px;
}
.setup-steps li::marker {
  color: var(--muted);
  font-weight: 600;
}
.setup-steps p {
  color: var(--muted);
  line-height: 1.7;
  font-size: var(--text-ui-caption);
  margin: 8px 0 12px;
}
.feishu-setup details {
  margin-top: 12px;
}
.feishu-setup summary {
  cursor: pointer;
  font-size: var(--text-ui-caption);
}
.feishu-setup textarea {
  box-sizing: border-box;
  width: 100%;
  height: 240px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: var(--text-ui-caption);
  resize: vertical;
}
.setup-steps code {
  overflow-wrap: anywhere;
}

.feishu-setup > p {
  color: var(--muted);
  font-size: var(--text-ui-caption);
  line-height: 1.7;
}
.setup-instructions {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-bottom: 16px;
}
.setup-instructions > summary {
  font-weight: 600;
  margin-bottom: 16px;
}
.feishu-setup > a {
  color: var(--muted);
  font-size: var(--text-ui-caption);
}
.settings-form > .model-advanced {
  margin-bottom: 20px;
}

.copy-feedback {
  margin-top: 12px;
}

.usage-filters {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.usage-filters label {
  display: grid;
  gap: 8px;
  flex: 1 1 160px;
}
.usage-filters input,
.usage-filters select {
  width: 100%;
}
.usage-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.usage-actions .actions {
  display: flex;
  gap: 8px;
}
.usage-actions .muted {
  flex: 1;
}
.usage-secondary {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: var(--text-ui-caption);
}
.usage-share {
  display: grid;
  gap: 6px;
  min-width: 80px;
}
.usage-share progress {
  width: 90px;
  height: 4px;
  accent-color: var(--brand);
}
.usage-analytics h2 {
  font-size: var(--text-ui-lg);
}
.usage-analytics h3 {
  font-size: var(--text-ui-base);
}
.usage-analytics td {
  font-variant-numeric: tabular-nums;
}
.usage-analytics .table {
  overflow-x: auto;
}
.usage-filters label {
  margin-bottom: 0;
}
.usage-analytics .summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.usage-actions > label {
  margin: 0;
  flex-direction: row;
  align-items: center;
}
.usage-actions > label select {
  width: auto;
}
@media (max-width: 1000px) {
  .usage-analytics .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.employee-login-details {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg);
  font-family: inherit;
  font-size: var(--text-ui-base);
  line-height: 1.7;
  resize: vertical;
  overflow-wrap: anywhere;
}
.conversations .table {
  overflow-x: auto;
}
.conversation-title {
  max-width: 260px;
  overflow-wrap: anywhere;
}
.conversation-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 20px 0;
}
.conversation-pagination label {
  margin: 0;
  flex-direction: row;
  align-items: center;
}
.conversation-pagination select {
  width: auto;
}
.conversation-meta {
  overflow-wrap: anywhere;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}
.conversation-question,
.conversation-answer {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-wrap: anywhere;
}
.conversation-question {
  background: var(--surface);
}
.conversation-question h3 {
  font-size: var(--text-ui-base);
  margin: 0;
  padding: 0;
  border: 0;
}
.conversation-question > header {
  margin-bottom: 12px;
}
.conversation-question > header,
.conversation-answer header {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.conversation-question > header small,
.conversation-answer header span,
.conversation-meta small {
  font-size: var(--text-ui-caption);
  color: var(--muted);
}
.conversation-markdown {
  white-space: normal;
  line-height: 1.7;
}
.conversation-markdown pre {
  overflow: auto;
  padding: 12px;
  background: var(--surface);
  border-radius: 8px;
}
.conversation-markdown table {
  display: block;
  overflow-x: auto;
}
.conversation-markdown h1,
.conversation-markdown h2 {
  font-size: var(--text-ui-lg);
}
.conversation-markdown h3,
.conversation-markdown h4 {
  font-size: var(--text-ui-base);
}
.conversation-warning {
  color: var(--danger);
  font-size: var(--text-ui-caption);
}
.editor-dialog.conversation-dialog {
  width: min(960px, calc(100vw - 32px));
  height: min(960px, calc(100dvh - 48px));
  padding: 0;
  overflow: hidden;
}
.conversation-dialog[open] {
  display: flex;
  flex-direction: column;
}
.conversation-dialog > .dialog-heading {
  flex: none;
  padding: 20px 24px 12px;
  margin: 0;
}
.conversation-dialog-summary {
  flex: none;
  padding: 0 24px 16px;
}
.conversation-dialog-summary > strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.conversation-dialog-summary > p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: var(--text-ui-caption);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 原弹窗和工具结果各自滚动，滚轮会被内部结果截住；统一由正文承载纵向滚动。 */
.conversation-dialog-body {
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--border);
  padding: 16px 24px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.conversation-dialog-body:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}
.conversation-dialog-body .conversation-markdown pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .editor-dialog.conversation-dialog {
    width: calc(100vw - 24px);
    height: calc(100dvh - 24px);
    max-height: calc(100dvh - 24px);
  }
  .conversation-dialog > .dialog-heading {
    padding: 16px 16px 12px;
  }
  .conversation-dialog-summary {
    padding: 0 16px 12px;
  }
  .conversation-dialog-body {
    padding: 12px 16px 16px;
  }
  .conversation-dialog .conversation-question,
  .conversation-dialog .conversation-answer,
  .conversation-dialog .conversation-tool > header,
  .conversation-dialog .conversation-tool details {
    padding: 12px;
  }
}

/* 长标题必须在单元格内换行截断，不能用 td 的 max-width 撑开整张表。 */
/* 列表列宽不能泄漏到明细的 Markdown 表格，否则窄屏正文会被撑到 900px。 */
.conversations > .table > table {
  table-layout: fixed;
  /* 移除 Token 列后收紧最小宽度，避免常规桌面宽度裁掉最后的操作按钮。 */
  min-width: 900px;
}
.conversations > .table th,
.conversations > .table td {
  padding-inline: 12px;
}
.conversations > .table td {
  overflow-wrap: anywhere;
  white-space: normal;
}
.conversation-title-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
  font-weight: 600;
}
.conversation-title .usage-secondary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-tools {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.conversation-tool {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.conversation-tool > header {
  padding: 12px 16px;
  background: var(--bg);
}
.conversation-tool details {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.conversation-tool summary {
  cursor: pointer;
  font-weight: 500;
}
.conversation-tool pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 12px 0 0;
  padding: 12px;
  background: var(--bg);
  border-radius: 6px;
  line-height: 1.6;
}
.conversation-technical {
  color: var(--muted);
  margin-top: 8px;
  overflow-wrap: anywhere;
}
.conversation-meta > strong {
  display: block;
  overflow-wrap: anywhere;
}
.conversation-legacy-tools {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.recharge-section {
  margin-top: 32px;
}
.recharge-section .section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.recharge-section .section-heading h3 {
  border: 0;
  padding: 0;
  margin: 0;
}
.recharge-notice {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  margin-bottom: 20px;
}
.recharge-notice p {
  margin: 4px 0 0;
  font-size: var(--text-ui-caption);
}
.recharge-amount-group {
  display: grid;
  gap: 12px;
}
.recharge-amount-group > label {
  margin: 0;
}
.recharge-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.recharge-options button[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--selected);
}
.recharge-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 16px;
  background: var(--surface);
  border-radius: 10px;
  margin: 20px 0;
}
.recharge-total strong {
  font-size: var(--text-ui-xl);
  font-variant-numeric: tabular-nums;
}
.recharge-total span {
  color: var(--muted);
  font-size: var(--text-ui-caption);
}
.recharge-section .cell-secondary {
  overflow-wrap: anywhere;
}
.recharge-section .form-actions {
  flex-wrap: wrap;
}
.recharge-submit {
  min-inline-size: 11em;
}
button.recharge-submit[aria-busy="true"] {
  opacity: 1;
  cursor: progress;
}
.recharge-pay-spinner {
  width: 1em;
  height: 1em;
  flex: none;
  border: 2px solid color-mix(in srgb, currentColor 32%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
}
@media (prefers-reduced-motion: no-preference) {
  .recharge-pay-spinner {
    animation: recharge-spin 0.8s linear infinite;
  }
}
@keyframes recharge-spin {
  to {
    transform: rotate(1turn);
  }
}
.recharge-scan-dialog {
  width: min(376px, calc(100% - 32px));
}
.recharge-scan {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}
.recharge-scan[hidden] {
  display: none;
}
.recharge-scan-amount {
  display: grid;
  gap: 4px;
}
.recharge-scan-amount > strong {
  font-size: var(--text-ui-xl);
  font-variant-numeric: tabular-nums;
}
.recharge-scan-label,
.recharge-scan-hint {
  color: var(--muted);
  font-size: var(--text-ui-caption);
}
.recharge-scan-hint strong {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.recharge-scan-code {
  display: grid;
  place-items: center;
  width: 216px;
  height: 216px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.recharge-scan-frame {
  /* 支付宝把码画在内嵌页左上角；窗口匹配实际码宽，留白由外层居中提供。 */
  display: block;
  width: 176px;
  height: 180px;
  border: 0;
}
.recharge-scan-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 16px;
  margin-top: 4px;
}
.recharge-scan-footer button,
.recharge-scan-footer a {
  color: var(--muted);
  font-size: var(--text-ui-sm);
  text-underline-offset: 3px;
}
.recharge-scan-footer button {
  background: transparent;
  border-color: transparent;
  padding: 5px 0;
}
@media (max-width: 600px) {
  .recharge-options {
    grid-template-columns: repeat(2, 1fr);
  }
}

.commercial-page {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.commercial-page p,
.commercial-page .summary-grid {
  margin-bottom: 0;
}
.commercial-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  padding: 28px;
  max-width: 720px;
  min-width: 0;
  display: grid;
  gap: 20px;
}
.commercial-wide {
  max-width: none;
}
.commercial-card h2,
.commercial-card .section-heading {
  margin: 0;
}
.commercial-card form {
  display: grid;
  gap: 18px;
}
.commercial-card label {
  margin: 0;
}
.commercial-details {
  margin: 0;
  display: grid;
  gap: 12px;
}
.commercial-details div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}
.commercial-details dt {
  color: var(--muted);
  min-width: 80px;
}
.commercial-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.commercial-actions,
.commercial-breakdown,
.commercial-toolbar,
.commercial-toolbar form,
.commercial-tabs,
.commercial-pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.commercial-toolbar {
  justify-content: space-between;
  align-items: end;
}
.commercial-toolbar form {
  align-items: end;
}
.commercial-toolbar label {
  margin: 0;
  gap: 6px;
}
.commercial-toolbar input {
  width: auto;
}
.commercial-breakdown {
  color: var(--muted);
  gap: 12px 28px;
}
.commercial-tabs {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.commercial-tabs button[aria-selected="true"] {
  background: var(--selected);
  color: var(--fg);
}
.commercial-pager {
  justify-content: flex-end;
  color: var(--muted);
}
.commercial-id {
  min-width: 130px;
  max-width: 220px;
  overflow-wrap: anywhere;
  white-space: normal;
}
.commercial-services {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin: 0 0 20px;
}
.commercial-services legend {
  padding: 0 6px;
}
.commercial-services small {
  color: var(--muted);
}
@media (max-width: 700px) {
  .commercial-card {
    padding: 20px;
  }
  .commercial-toolbar,
  .commercial-toolbar form {
    width: 100%;
  }
  .commercial-toolbar label {
    flex: 1;
    min-width: 130px;
  }
  .commercial-toolbar input {
    width: 100%;
  }
  .commercial-tabs {
    gap: 8px;
  }
}

.platform-login-return {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  background: var(--panel);
  text-decoration: none;
  font-weight: 500;
}
.platform-login-return:hover {
  background: var(--hover);
}

.brand > div {
  min-width: 0;
}
.brand span[title] {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
