.edge-chat { display: grid; gap: 24px; min-width: 0; color: var(--edge-text-primary); }
.edge-chat__head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.edge-chat h1 { margin: 4px 0 8px; font-size: 30px; line-height: 36px; font-weight: 600; }
.edge-chat h2 { margin: 0 0 16px; font-size: 18px; line-height: 28px; font-weight: 600; }
.edge-chat p { margin: 8px 0; font-size: 14px; line-height: 20px; text-wrap: pretty; }
.edge-chat__eyebrow, .edge-chat__muted, .edge-chat small { color: var(--edge-text-muted); }
.edge-chat small { font-size: 12px; line-height: 16px; font-weight: 400; }
.edge-chat__head p { color: var(--edge-text-secondary); }
.edge-chat__panel { min-width: 0; padding: 24px; border: 1px solid var(--edge-border-light); border-radius: 8px; background: var(--edge-surface); }
.edge-chat__metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
.edge-chat__metrics .edge-chat__panel { display: grid; gap: 8px; }
.edge-chat__metrics span { color: var(--edge-text-secondary); font-size: 14px; line-height: 20px; }
.edge-chat__metrics strong { overflow-wrap: anywhere; font-size: 24px; line-height: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }
.edge-chat__status h2 { margin-bottom: 8px; }
.edge-chat__status p { color: var(--edge-text-secondary); }
.edge-chat .edge-chat__warning { color: var(--edge-danger); }
.edge-chat__rankings { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.edge-chat__ranking { display: grid; gap: 16px; padding: 0; margin: 0; list-style: none; }
.edge-chat__ranking li { min-width: 0; }
.edge-chat__ranking li > div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; line-height: 20px; }
.edge-chat__ranking strong { overflow-wrap: anywhere; font-weight: 600; }
.edge-chat__ranking span { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.edge-chat__ranking p { color: var(--edge-text-muted); font-size: 12px; line-height: 16px; }
.edge-chat__fields { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.edge-chat__fields label { display: grid; gap: 8px; min-width: 0; font-size: 14px; line-height: 20px; }
.edge-chat input[type=number] { box-sizing: border-box; width: 100%; min-width: 0; padding: 8px 12px; border: 1px solid var(--edge-border); border-radius: 4px; color: var(--edge-text-primary); background: var(--edge-bg); font: inherit; font-variant-numeric: tabular-nums; }
.edge-chat input[type=number]:hover { border-color: var(--edge-text-muted); }
.edge-chat input:focus-visible, .edge-chat button:focus-visible, .edge-chat a:focus-visible { outline: 2px solid var(--edge-primary); outline-offset: 2px; }
.edge-chat__groups { min-width: 0; margin: 24px 0; padding: 16px; border: 1px solid var(--edge-border-light); border-radius: 4px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 32px; }
.edge-chat__groups legend { padding: 0 8px; font-size: 16px; line-height: 24px; }
.edge-chat__groups label { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: center; gap: 12px; font-size: 14px; line-height: 20px; }
.edge-chat__groups span { overflow-wrap: anywhere; }
.edge-chat__save { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.edge-chat__save p { margin: 0; }
.edge-chat .edge-button { font-size: 16px; font-weight: 600; padding: 8px 12px; }
.edge-chat:not(.chat-app) button:disabled { opacity: .6; cursor: wait; }
.edge-chat:not(.chat-app) button:active:not(:disabled) { transform: translateY(1px); }
.edge-chat__empty { padding: 32px; }
.edge-chat.chat-admin { gap: 16px; }
.chat-admin__head { display: grid; gap: 6px; }
.chat-admin__back { display: inline-flex; align-items: center; gap: 6px; justify-self: start; color: var(--edge-text-muted); font-size: 13px; line-height: 20px; text-decoration: none; }
.chat-admin__back:hover { color: var(--edge-text-primary); }
.chat-admin__back i { font-size: 11px; }
.edge-chat .chat-admin__head h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 22px; line-height: 30px; }
.chat-admin__mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--edge-surface-active); color: var(--edge-primary); font-size: 17px; }
.chat-admin__tabs { display: flex; gap: 20px; margin-bottom: 4px; border-bottom: 1px solid var(--edge-border-light); overflow-x: auto; scrollbar-width: none; }
.chat-admin__tabs a { flex: none; margin-bottom: -1px; padding: 8px 0 10px; border-bottom: 2px solid transparent; color: var(--edge-text-secondary); font-size: 14px; line-height: 20px; text-decoration: none; transition: color var(--edge-transition-fast), border-color var(--edge-transition-fast); }
.chat-admin__tabs a:hover { color: var(--edge-text-primary); }
.chat-admin__tabs a[aria-current] { border-bottom-color: var(--edge-primary); color: var(--edge-text-primary); font-weight: 600; }
.chat-admin .edge-button { min-height: 34px; padding: 6px 14px; font-size: 14px; font-weight: 500; line-height: 20px; }
.chat-admin__section-head { display: grid; gap: 2px; margin-bottom: 16px; }
.chat-admin .chat-admin__section .chat-admin__section-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; }
.chat-admin .chat-admin__section-head p { margin: 0; color: var(--edge-text-muted); font-size: 13px; line-height: 20px; }
.chat-admin__count { padding: 0 8px; border-radius: 999px; background: var(--edge-warning-low, var(--edge-surface-active)); color: var(--edge-warning); font-size: 12px; font-weight: 500; line-height: 20px; }
.chat-admin__stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.chat-admin__stats > div { display: grid; gap: 2px; min-width: 0; padding: 0 20px; border-left: 1px solid var(--edge-border-light); }
.chat-admin__stats > div:first-child { padding-left: 0; border-left: 0; }
.chat-admin__stats dt { color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; }
.chat-admin__stats dd { margin: 0; font-size: 22px; line-height: 30px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chat-admin__stats small { color: var(--edge-text-muted); }
.chat-admin__status { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--edge-border-light); color: var(--edge-text-secondary); font-size: 13px; }
.chat-admin__status a { color: var(--edge-primary); }
.chat-admin__status + .chat-admin__notice { margin-top: 12px; }
.chat-admin__ranks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.chat-admin__ranks > section { min-width: 0; padding: 0 20px; border-left: 1px solid var(--edge-border-light); }
.chat-admin__ranks > section:first-child { padding-left: 0; border-left: 0; }
.chat-admin__ranks > section:last-child { padding-right: 0; }
.edge-chat .chat-admin__ranks h3 { margin: 0 0 8px; color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; font-weight: 600; }
.chat-admin__ranks ol { display: grid; margin: 0; padding: 0; list-style: none; }
.chat-admin__ranks li { display: grid; gap: 1px; padding: 8px 0; border-top: 1px solid var(--edge-border-light); }
.chat-admin__ranks li:first-child { border-top: 0; padding-top: 0; }
.chat-admin__ranks li > div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; line-height: 20px; }
.chat-admin__ranks strong { min-width: 0; overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.chat-admin__ranks strong small { margin-left: 4px; }
.chat-admin__ranks li > div span { flex: none; font-variant-numeric: tabular-nums; }
.chat-admin__ranks li > small { font-variant-numeric: tabular-nums; }
.chat-admin__fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.chat-admin__fields label { display: grid; gap: 6px; min-width: 0; color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; }
.chat-admin__input { position: relative; display: block; }
.chat-admin__input em { position: absolute; top: 50%; right: 12px; color: var(--edge-text-muted); font-size: 13px; font-style: normal; transform: translateY(-50%); pointer-events: none; }
.edge-chat.chat-admin input[type=number], .edge-chat.chat-admin input[type=search] { min-height: 0; height: 34px; padding: 0 10px; border-radius: 6px; font-size: 14px; }
.chat-admin__fields + .chat-admin__help { margin-top: 8px; }
.chat-admin__input input[type=number] { padding-right: 52px; }
.edge-chat.chat-admin input[type=number]:focus { border-color: var(--edge-primary); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--edge-primary) 18%, transparent); }
.edge-chat .chat-admin__subhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 24px 0 10px; padding-top: 20px; border-top: 1px solid var(--edge-border-light); font-size: 14px; line-height: 20px; font-weight: 600; }
.chat-admin__quotas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.chat-admin__quotas label { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 6px 0; border-bottom: 1px solid var(--edge-border-light); font-size: 14px; line-height: 20px; }
.chat-admin__quotas label > span { min-width: 0; overflow-wrap: anywhere; }
.chat-admin__quotas small { margin-left: 6px; }
.edge-chat.chat-admin .chat-admin__quotas input { flex: none; width: 140px; height: 30px; text-align: right; }
.chat-admin__savebar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 16px; }
.chat-admin .chat-admin__savebar p { margin: 0; color: var(--edge-text-secondary); font-size: 13px; }
.chat-admin__personas { margin: 0; padding: 0; list-style: none; }
.chat-admin__persona { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 16px 0; border-top: 1px solid var(--edge-border-light); }
.chat-admin__persona:first-child { padding-top: 0; border-top: 0; }
.chat-admin__persona-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--edge-surface-active); color: var(--edge-text-secondary); font-size: 15px; }
.chat-admin__persona-main { min-width: 0; }
.chat-admin__persona-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.chat-admin__persona-title strong { font-size: 15px; line-height: 22px; font-weight: 600; }
.chat-admin .chat-admin__persona-main > p { margin: 2px 0 4px; color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; }
.chat-admin__meta { display: flex; flex-wrap: wrap; gap: 4px 0; }
.chat-admin__meta span + span::before { content: "·"; margin: 0 8px; }
.chat-admin__persona-more { margin-top: 6px; }
.chat-admin__persona-more summary { display: inline-flex; align-items: center; gap: 6px; color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; cursor: pointer; list-style: none; }
.chat-admin__persona-more summary::-webkit-details-marker { display: none; }
.chat-admin__persona-more summary::before { content: "\f054"; font: var(--fa-font-solid); font-size: 9px; transition: transform var(--edge-transition-fast); }
.chat-admin__persona-more[open] summary::before { transform: rotate(90deg); }
.chat-admin__persona-more summary:hover { color: var(--edge-text-primary); }
.chat-admin__persona-more pre { margin: 8px 0; padding: 10px 12px; max-height: 240px; overflow: auto; border-radius: 6px; background: var(--edge-bg); color: var(--edge-text-primary); font: inherit; font-size: 13px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-admin .chat-admin__tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.chat-admin__tools span { padding: 0 8px; border-radius: 4px; background: var(--edge-surface-active); color: var(--edge-text-secondary); font-size: 12px; line-height: 22px; }
.chat-admin__tools em { color: var(--edge-text-muted); font-size: 12px; font-style: normal; }
.chat-admin__persona-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 2px; }
.chat-admin__persona-actions .chat-switch { padding: 0; }
.chat-admin__notice { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 14px; border-radius: 8px; background: color-mix(in srgb, var(--edge-success) 10%, var(--edge-surface)); color: var(--edge-text-primary); font-size: 14px; line-height: 20px; }
.chat-admin__notice > i { color: var(--edge-success); }
.chat-admin__notice.is-error { background: color-mix(in srgb, var(--edge-danger) 10%, var(--edge-surface)); }
.chat-admin__notice.is-error > i { color: var(--edge-danger); }
.chat-admin__section { min-width: 0; padding: 20px 24px; border: 1px solid var(--edge-border-light); border-radius: 8px; background: var(--edge-surface); }
.chat-admin .chat-admin__section h2 { margin: 0 0 14px; font-size: 16px; line-height: 24px; font-weight: 600; }
.chat-admin__modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.chat-admin__mode-card { position: relative; display: block; min-width: 0; padding: 14px 16px; border: 1px solid var(--edge-border-light); border-radius: 8px; cursor: pointer; transition: border-color var(--edge-transition-fast), background-color var(--edge-transition-fast); }
.chat-admin__mode-card:hover { background: var(--edge-surface-hover); }
.chat-admin__mode-card:active { background: var(--edge-surface-active); }
.chat-admin__mode-card input { position: absolute; top: 15px; right: 14px; width: 16px; height: 16px; margin: 0; appearance: auto; accent-color: var(--edge-primary); }
.chat-admin__mode-card:has(input:checked) { border-color: var(--edge-primary); background: color-mix(in srgb, var(--edge-primary) 6%, var(--edge-surface)); }
.chat-admin__mode-card:has(input:focus-visible) { outline: 2px solid var(--edge-primary); outline-offset: 2px; }
.chat-admin__mode-card span { display: grid; gap: 4px; padding-right: 24px; }
.chat-admin__mode-card strong { display: flex; align-items: center; gap: 8px; font-size: 15px; line-height: 22px; font-weight: 600; }
.chat-admin__mode-card strong i { color: var(--edge-text-muted); font-size: 13px; }
.chat-admin__mode-card:has(input:checked) strong i { color: var(--edge-primary); }
.chat-admin .chat-admin__mode-card small { color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; }
.chat-admin__mode-save { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; color: var(--edge-text-secondary); font-size: 13px; }
.chat-admin__mode-save[hidden] { display: none; }
.chat-admin__search { position: relative; display: flex; gap: 8px; }
.chat-admin__search > i { position: absolute; top: 50%; left: 12px; color: var(--edge-text-muted); font-size: 13px; transform: translateY(-50%); pointer-events: none; }
.chat-admin input[type=search] { box-sizing: border-box; flex: 1; min-width: 0; height: 34px; padding: 0 12px 0 34px !important; border: 1px solid var(--edge-border); border-radius: 6px; color: var(--edge-text-primary); background: var(--edge-bg); font-family: inherit; font-size: 14px; }
.chat-admin input[type=search]:focus { border-color: var(--edge-primary); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--edge-primary) 18%, transparent); }
.chat-admin .chat-admin__empty, .chat-admin .chat-admin__hint { margin: 12px 0 0; color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; }
.chat-admin__hint a { color: var(--edge-primary); }
.chat-admin__member { margin-top: 16px; padding: 16px; border-radius: 8px; background: var(--edge-bg); overflow-wrap: anywhere; }
.chat-admin__who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-admin__avatar img, .chat-admin__avatar .edge-avatar-fallback { display: block; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.chat-admin__who > div { display: grid; flex: 1; min-width: 0; }
.chat-admin__who strong { font-size: 15px; line-height: 22px; }
.chat-admin__state { display: inline-flex; flex: none; align-items: center; gap: 6px; color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; white-space: nowrap; }
.chat-admin__state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--edge-text-disabled, var(--edge-border)); }
.chat-admin__state.is-ok::before { background: var(--edge-success); }
.chat-admin__state.is-wait::before { background: var(--edge-warning); }
.chat-admin__state.is-off::before { background: var(--edge-danger); }
.chat-admin__state.is-ok, .chat-admin__state.is-wait, .chat-admin__state.is-off { color: var(--edge-text-primary); }
.chat-admin__who .chat-admin__state small { margin-left: 2px; }
.chat-admin__grant { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 16px; }
.chat-admin__days { display: grid; gap: 6px; color: var(--edge-text-secondary); font-size: 13px; line-height: 18px; }
.chat-admin .chat-admin__days input { width: 96px; }
.chat-admin__buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-admin .chat-admin__help { flex-basis: 100%; margin: 0; color: var(--edge-text-muted); font-size: 12px; line-height: 18px; }
.chat-admin__more { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--edge-border-light); }
.chat-admin__more form { margin: 0; }
.chat-admin__text-btn { padding: 2px 0; border: 0; background: none; color: var(--edge-text-secondary); font: inherit; font-size: 13px; cursor: pointer; }
.chat-admin__text-btn:hover { color: var(--edge-text-primary); text-decoration: underline; text-underline-offset: 2px; }
.chat-admin__text-btn.is-danger:hover { color: var(--edge-danger); }
.chat-admin__list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 4px; }
.chat-admin .chat-admin__list-head h2 { margin: 0; }
.chat-admin__filters { display: flex; flex-wrap: wrap; gap: 4px; }
.chat-admin__filters a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; text-decoration: none; }
.chat-admin__filters a:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-admin__filters a[aria-current] { background: var(--edge-surface-active); color: var(--edge-text-primary); font-weight: 600; }
.chat-admin__filters b { color: var(--edge-text-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.chat-admin__records { margin: 0; padding: 0; list-style: none; }
.chat-admin__records li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr) minmax(0, 1.2fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--edge-border-light); font-size: 14px; line-height: 20px; }
.chat-admin__records li:first-child { border-top: 0; }
.chat-admin__record-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; color: var(--edge-text-primary); font-weight: 500; text-decoration: none; overflow-wrap: anywhere; }
.chat-admin__record-name:hover { color: var(--edge-primary); }
.chat-admin__term, .chat-admin__updated { color: var(--edge-text-secondary); font-variant-numeric: tabular-nums; }
.chat-admin .chat-admin__updated { color: var(--edge-text-muted); font-size: 12px; white-space: nowrap; }
.chat-admin__pager { display: flex; gap: 16px; margin-top: 12px; font-size: 13px; }
.chat-admin__pager a { color: var(--edge-primary); }
.chat-access__member-title { display: flex; gap: 12px; align-items: center; }
.chat-access__member-title h2 { margin: 0; }
.chat-access__member-title > span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; color: var(--edge-primary); background: var(--edge-bg); font-size: 24px; }
.chat-access__terms { display: flex; flex-wrap: wrap; gap: 16px 32px; margin: 16px 0; padding: 12px; border-radius: 8px; background: var(--edge-bg); }
.chat-access__terms dt { font-size: 12px; color: var(--edge-text-secondary); }
.chat-access__terms dd { margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.chat-access--member .edge-button--primary { margin-top: 8px; }
.chat-gate .chat-status:empty { display: none; }
.chat-gate form { margin: 0; }
@media (max-width: 900px) {
  .chat-admin__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 0; }
  .chat-admin__stats > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .chat-admin__ranks { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .chat-admin__ranks > section { padding: 0; border-left: 0; }
}
@media (max-width: 720px) {
  .chat-admin__section { padding: 16px; }
  .chat-admin__fields, .chat-admin__quotas { grid-template-columns: minmax(0, 1fr); }
  .chat-admin__persona { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; }
  .chat-admin__persona-icon { width: 32px; height: 32px; }
  .chat-admin__persona:has(.edge-button) { grid-template-columns: 32px minmax(0, 1fr); }
  .chat-admin__persona:has(.edge-button) .chat-admin__persona-actions { grid-column: 2; justify-content: flex-start; }
  .chat-admin__modes { grid-template-columns: minmax(0, 1fr); }
  .chat-admin__who { flex-wrap: wrap; }
  .chat-admin__who > div { flex-basis: calc(100% - 52px); }
  .chat-admin__who .chat-admin__state { padding-left: 52px; }
  .chat-admin__records li { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
  .chat-admin__term, .chat-admin__updated { grid-column: 1 / -1; font-size: 12px; }
  .chat-admin__updated { display: none; }
}
@media (max-width: 1100px) {
  .edge-chat__metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .edge-chat__rankings { grid-template-columns: minmax(0,1fr); }
  .edge-chat__groups { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 600px) {
  .edge-chat { gap: 16px; }
  .edge-chat__panel { padding: 16px; }
  .edge-chat__metrics { gap: 8px; }
  .edge-chat__metrics strong { font-size: 20px; line-height: 28px; }
  .edge-chat__fields { grid-template-columns: minmax(0,1fr); }
  .edge-chat__groups { padding: 12px; gap: 16px; }
}
.chat-persona { padding: 24px 0; border-bottom: 1px solid var(--edge-border-light); }

/* 会话页：应用式布局，消息区单独滚动，输入框常驻底部。 */
.edge-modern .edge-main:has(.chat-app) { padding-bottom: 0; }
.chat-app { --chat-side-w: 248px; --chat-col: 760px; --chat-top: calc(var(--edge-header-height) + 18px); --chat-tint: color-mix(in srgb, var(--edge-surface-hover) 55%, var(--edge-surface)); position: relative; display: grid; grid-template-columns: var(--chat-side-w) minmax(0,1fr); gap: 0 28px; align-items: start; min-height: calc(100vh - var(--chat-top) - 16px); min-height: calc(100dvh - var(--chat-top) - 16px); color: var(--edge-text-primary); }
.chat-app p { margin: 0; }
.chat-app button { -webkit-tap-highlight-color: transparent; }
.chat-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.chat-app :focus-visible { outline: 2px solid var(--edge-primary); outline-offset: 2px; }

/* 会话列表 */
.chat-side { position: sticky; top: var(--chat-top); display: flex; flex-direction: column; min-width: 0; height: calc(100vh - var(--chat-top) - 16px); height: calc(100dvh - var(--chat-top) - 16px); border: 1px solid var(--edge-border-light); border-radius: 12px; background: var(--chat-tint); }
.chat-side__top { display: flex; align-items: center; gap: 8px; padding: 12px; }
.chat-new { display: flex; flex: 1; align-items: center; gap: 10px; min-height: 38px; padding: 0 12px; border: 1px solid var(--edge-border); border-radius: 8px; background: var(--edge-surface); color: var(--edge-text-primary); font-size: 14px; font-weight: 600; text-decoration: none; transition: background-color var(--edge-transition-fast), border-color var(--edge-transition-fast); }
.chat-new:hover { border-color: var(--edge-text-muted); color: var(--edge-text-primary); text-decoration: none; }
.chat-new:active { background: var(--edge-surface-active); }
.chat-new i { color: var(--edge-text-secondary); }
.chat-side .chat-side__close { display: none; }
.chat-side__scroll { flex: 1; min-height: 0; padding: 4px 8px 16px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.chat-app .chat-side__label { margin: 8px 8px 6px; color: var(--edge-text-muted); font-size: 12px; font-weight: 600; line-height: 16px; }
.chat-side__list { display: grid; grid-template-columns: minmax(0,1fr); gap: 1px; }
.chat-side__item { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 34px; padding: 0 10px; border-radius: 6px; color: var(--edge-text-secondary); font-size: 14px; line-height: 20px; text-decoration: none; transition: background-color var(--edge-transition-fast), color var(--edge-transition-fast); }
.chat-side__item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-side__item i { flex: none; color: var(--edge-text-muted); font-size: 11px; }
.chat-side__item .chat-side__ico { width: 16px; font-size: 13px; text-align: center; }
.chat-msg__avatar .edge-ai-mark { width: 15px; height: 15px; }
.chat-welcome__mark .edge-ai-mark { width: 22px; height: 22px; }
.chat-side__item:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary); text-decoration: none; }
.chat-side__item:active { background: var(--edge-surface-active); }
.chat-side__item[aria-current] { background: var(--edge-surface-active); color: var(--edge-text-primary); font-weight: 600; }
.chat-side__item.is-new { animation: chat-in 240ms var(--edge-ease-out) backwards; }
.chat-side__head { display: flex; align-items: center; justify-content: space-between; gap: 4px; height: 28px; margin: 10px 2px 4px 8px; }
.chat-app .chat-side__head .chat-side__label { margin: 0; }
.chat-side__head[hidden] { display: none; }
.chat-app .chat-side__find { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--edge-text-muted); font-size: 12px; cursor: pointer; transition: background-color var(--edge-transition-fast), color var(--edge-transition-fast); }
.chat-app .chat-side__find:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-app .chat-side__find:active { background: var(--edge-surface-active); }
.chat-app .chat-history-search { position: relative; height: 28px; margin: 10px 2px 4px; animation: chat-in 160ms var(--edge-ease-out) both; }
.chat-app .chat-history-search[hidden] { display: none; }
.chat-history-search > i { position: absolute; top: 50%; left: 9px; color: var(--edge-text-muted); font-size: 11px; transform: translateY(-50%); pointer-events: none; }
.chat-app .chat-history-search input[type="search"] { display: block; width: 100%; height: 28px; min-height: 0; margin: 0; padding: 0 28px 0 27px; border: 1px solid transparent; border-radius: 6px; background: var(--edge-surface-hover); box-shadow: none; color: var(--edge-text-primary); font-family: inherit; font-size: 13px; line-height: 26px; -webkit-appearance: none; appearance: none; transition: border-color var(--edge-transition-fast), background-color var(--edge-transition-fast); }
.chat-app .chat-history-search input[type="search"]::placeholder { color: var(--edge-text-muted); }
.chat-app .chat-history-search input[type="search"]::-webkit-search-cancel-button { display: none; }
.chat-app .chat-history-search input[type="search"]:focus { outline: none; border-color: var(--edge-border); background: var(--edge-surface); }
.chat-app .chat-history-search__clear { position: absolute; top: 50%; right: 3px; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--edge-text-muted); font-size: 11px; transform: translateY(-50%); cursor: pointer; }
.chat-app .chat-history-search__clear:hover { background: var(--edge-surface-active); color: var(--edge-text-primary); }
.chat-app .chat-history-search + .chat-side__empty { padding-top: 2px; }
.chat-side__item mark { padding: 0; border-radius: 2px; background: color-mix(in srgb, var(--edge-primary) 18%, transparent); color: inherit; }
.chat-side__list[hidden] { display: none; }
.chat-app .chat-side__empty { padding: 6px 10px; color: var(--edge-text-muted); font-size: 13px; line-height: 20px; }
.chat-side__public { margin-top: 16px; }
.chat-side__public summary { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px; border-radius: 6px; color: var(--edge-text-muted); font-size: 12px; font-weight: 600; list-style: none; cursor: pointer; }
.chat-side__public summary::-webkit-details-marker { display: none; }
.chat-side__public summary:hover { color: var(--edge-text-primary); }
.chat-side__public summary small { color: var(--edge-text-muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.chat-side__public summary i { margin-left: auto; font-size: 10px; transition: transform var(--edge-transition-fast); }
.chat-side__public[open] summary i { transform: rotate(180deg); }
.chat-side__scrim { display: none; }

/* 会话主区 */
.chat-main { position: relative; display: flex; flex-direction: column; align-self: stretch; min-width: 0; }
.chat-bar { position: sticky; top: var(--edge-header-height); z-index: 5; display: flex; align-items: center; gap: 12px; min-height: 56px; margin-top: -18px; padding: 10px 0; border-bottom: 1px solid var(--edge-border-light); background: var(--edge-bg); }
.chat-bar__title, .chat-bar__actions { box-sizing: border-box; }
.chat-bar .chat-bar__menu { display: none; }
.chat-bar__title { flex: 1; min-width: 0; }
.chat-app .chat-bar h1 { margin: 0; overflow: hidden; font-size: 16px; font-weight: 600; line-height: 22px; text-overflow: ellipsis; white-space: nowrap; }
.chat-bar__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px !important; }
.chat-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 220px; overflow: hidden; color: var(--edge-text-muted); font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; }
.chat-chip + .chat-chip::before { content: ""; width: 3px; height: 3px; margin-right: 1px; border-radius: 50%; background: var(--edge-border); }
.chat-chip i { font-size: 10px; }
.chat-chip a { color: inherit; }
.chat-chip a:hover { color: var(--edge-primary); }
.chat-chip--quiet { color: var(--edge-warning); }
.chat-bar__actions { display: flex; flex: none; align-items: center; gap: 4px; }
.chat-bar__actions[hidden] { display: none; }
.chat-bar [data-edge-tip]::after { top: calc(100% + 6px); bottom: auto; }
.chat-bar .chat-tool-btn--danger[data-edge-tip]::after, .chat-bar .chat-switch[data-edge-tip]::after { left: auto; right: 0; transform: translateY(-3px); }
.chat-bar .chat-switch[data-edge-tip]:hover::after { transform: none; }
.chat-bar .chat-switch { margin-right: 4px; }
.chat-bar .chat-tool-btn--danger[data-edge-tip]:hover::after { transform: none; }
.chat-tool-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 34px; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--edge-text-secondary); font: inherit; font-size: 13px; cursor: pointer; transition: background-color var(--edge-transition-fast), color var(--edge-transition-fast), transform 90ms ease; }
.chat-tool-btn:hover:not(:disabled) { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-tool-btn:active:not(:disabled) { background: var(--edge-surface-active); transform: scale(.96); }
.chat-tool-btn--danger:hover:not(:disabled) { background: var(--edge-danger-low); color: var(--edge-danger); }
.chat-tool-btn:disabled { color: var(--edge-text-disabled); cursor: not-allowed; }
.chat-tool-btn.is-busy { cursor: progress; opacity: .7; }
.chat-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--edge-text-muted); font-size: 13px; cursor: pointer; transition: background-color var(--edge-transition-fast), color var(--edge-transition-fast), transform 90ms ease; }
.chat-icon-btn:hover:not(:disabled) { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-icon-btn:active:not(:disabled) { background: var(--edge-surface-active); transform: scale(.92); }
.chat-icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.chat-icon-btn.is-done, .chat-icon-btn.is-done:hover { color: var(--edge-success); }

.chat-scroll { position: relative; flex: 1; }
.chat-thread { box-sizing: border-box; width: 100%; max-width: var(--chat-col); margin: 0 auto; padding: 28px 0 32px; }
.chat-note { display: flex; align-items: center; gap: 8px; margin: 0 0 16px !important; padding: 8px 12px; border-radius: 8px; background: var(--edge-warning-low); color: var(--edge-warning); font-size: 13px; line-height: 20px; }
.chat-note[hidden] { display: none; }
.chat-messages { display: grid; gap: 28px; }

/* 消息 */
@keyframes chat-in { from { opacity: 0; transform: translateY(6px); } }
.chat-msg { min-width: 0; overflow-wrap: anywhere; }
.chat-msg.is-anchored { scroll-margin-top: 0; }
.chat-msg.is-new { animation: chat-in 260ms var(--edge-ease-out) backwards; }
.chat-msg--user { display: flex; flex-direction: column; align-items: flex-end; }
.chat-user-actions { display: flex; align-items: center; gap: 4px; margin-top: 2px; color: var(--edge-text-muted); }
.chat-user-actions small { font-size: 12px; }
.chat-user-actions [data-edge-tip]::after { left: auto; right: 0; transform: translateY(3px); }
.chat-user-actions [data-edge-tip]:hover::after { transform: none; }
.chat-welcome[hidden] { display: none; }
.chat-msg__bubble { max-width: min(85%, 600px); padding: 10px 16px; border-radius: 18px 18px 4px 18px; background: var(--edge-surface-active); color: var(--edge-text-primary); font-size: 15px; line-height: 24px; white-space: pre-wrap; }
.chat-msg__bubble br { display: none; }
.chat-msg--assistant { display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 14px; }
.chat-msg__avatar, .chat-welcome__mark { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--edge-primary-low); color: var(--edge-primary); font-size: 12px; }
.chat-msg__main { min-width: 0; }
.chat-msg__head { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 14px; }
.chat-msg__head strong { font-weight: 600; }
.chat-ai-tag { padding: 0 6px; border: 1px solid var(--edge-border-light); border-radius: 4px; color: var(--edge-text-muted); font-size: 11px; line-height: 18px; }
.chat-app .chat-msg__body { min-width: 0; margin-top: 6px; padding: 0; color: var(--edge-text-primary); font-size: 15px; line-height: 26px; letter-spacing: 0; }
.chat-app .chat-msg__body > :first-child { margin-top: 0; }
.chat-app .chat-msg__body > :last-child { margin-bottom: 0; }
.chat-app .chat-msg__body p { margin: 0 0 14px; font-size: inherit; line-height: inherit; }
.chat-app .chat-msg__body strong { font-weight: 600; color: var(--edge-text-primary); }
.chat-app .chat-msg__body ul, .chat-app .chat-msg__body ol { margin: 0 0 14px; padding-left: 24px; }
.chat-app .chat-msg__body li { margin: 6px 0; padding-left: 2px; }
.chat-app .chat-msg__body li::marker { color: var(--edge-text-muted); font-variant-numeric: tabular-nums; }
.chat-app .chat-msg__body li > p { margin: 0; }
.chat-app .chat-msg__body li > ul, .chat-app .chat-msg__body li > ol { margin: 4px 0 0; }
.chat-app .chat-msg__body h1, .chat-app .chat-msg__body h2, .chat-app .chat-msg__body h3, .chat-app .chat-msg__body h4 { margin: 26px 0 8px; padding: 0; border: 0; color: var(--edge-text-primary); font-weight: 600; letter-spacing: 0; }
.chat-app .chat-msg__body h1, .chat-app .chat-msg__body h2 { font-size: 18px; line-height: 28px; }
.chat-app .chat-msg__body h3 { font-size: 16px; line-height: 26px; }
.chat-app .chat-msg__body h4 { margin-top: 20px; font-size: 15px; line-height: 24px; }
.chat-app .chat-msg__body blockquote { margin: 0 0 14px; padding: 2px 0 2px 14px; border-left: 3px solid var(--edge-border); color: var(--edge-text-secondary); }
.chat-app .chat-msg__body hr { margin: 24px 0; border: 0; border-top: 1px solid var(--edge-border-light); }
.chat-app .chat-msg__body code { padding: 1px 5px; border-radius: 4px; background: var(--edge-code-bg); color: var(--edge-code-text); font-size: .88em; }
.chat-app .chat-msg__body pre { position: relative; max-width: 100%; margin: 0 0 14px; padding: 14px 16px; overflow: auto; border: 1px solid var(--edge-code-border); border-radius: 8px; background: var(--edge-code-bg); white-space: pre; font-size: 13px; line-height: 1.6; }
.chat-app .chat-msg__body pre code { padding: 0; background: transparent; font-size: inherit; overflow-wrap: normal; word-break: normal; }
.chat-table { max-width: 100%; margin: 4px 0 16px; overflow-x: auto; border: 1px solid var(--edge-border-light); border-radius: 8px; }
.chat-app .chat-msg__body .chat-table table { display: table; width: 100%; margin: 0; border: 0; border-collapse: collapse; font-size: 14px; line-height: 22px; }
.chat-app .chat-msg__body .chat-table th, .chat-app .chat-msg__body .chat-table td { padding: 9px 14px; border: 0; text-align: left; vertical-align: top; }
.chat-app .chat-msg__body .chat-table th { color: var(--edge-text-secondary); font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--chat-tint); }
.chat-app .chat-msg__body .chat-table tr { border: 0; border-top: 1px solid var(--edge-border-light); background: transparent; }
.chat-app .chat-msg__body .chat-table thead tr { border-top: 0; }
.chat-app .chat-msg__body img { display: none; }
.edge-modern .chat-cite { --cite-bg: color-mix(in srgb, var(--edge-text-primary) 6%, transparent); display: inline-flex; align-items: center; gap: 5px; max-width: 12em; height: 20px; margin: 0 1px 0 4px; padding: 0 8px 0 7px; box-sizing: border-box; border-radius: 999px; background: var(--cite-bg); color: var(--edge-text-secondary) !important; font-size: 12px; font-weight: 500; line-height: 20px; letter-spacing: 0; text-decoration: none !important; text-indent: 0; vertical-align: 1px; white-space: nowrap; cursor: pointer; transition: background-color 160ms var(--edge-ease-out), color 160ms var(--edge-ease-out), box-shadow 160ms var(--edge-ease-out); }
.edge-modern .chat-cite__dot { flex: none; width: 6px; height: 6px; border-radius: 50%; }
.chat-cite__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chat-cite__more { flex: none; margin-left: -1px; color: var(--edge-text-muted); font-variant-numeric: tabular-nums; transition: color 160ms var(--edge-ease-out); }
.edge-modern a.chat-cite.is-active { --cite-bg: color-mix(in srgb, var(--edge-text-primary) 12%, transparent); color: var(--edge-text-primary) !important; }
.edge-modern a.chat-cite.is-active .chat-cite__more { color: var(--edge-text-secondary); }
.edge-modern a.chat-cite.is-linked { --cite-bg: color-mix(in srgb, var(--edge-primary) 14%, transparent); color: var(--edge-primary) !important; box-shadow: 0 0 0 1px color-mix(in srgb, var(--edge-primary) 35%, transparent); }
@media (hover: hover) { .edge-modern a.chat-cite:hover { --cite-bg: color-mix(in srgb, var(--edge-text-primary) 12%, transparent); color: var(--edge-text-primary) !important; } .edge-modern a.chat-cite:hover .chat-cite__more { color: var(--edge-text-secondary); } }
.edge-modern a.chat-cite:active { --cite-bg: color-mix(in srgb, var(--edge-text-primary) 16%, transparent); }
.edge-modern a.chat-cite:focus-visible { outline: 2px solid var(--edge-primary); outline-offset: 1px; }
::highlight(chat-cite) { background-color: color-mix(in srgb, var(--edge-primary) 15%, transparent); }
.chat-msg__error { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--edge-danger) 30%, transparent); border-radius: 8px; background: var(--edge-danger-low); color: var(--edge-danger); font-size: 14px; line-height: 20px; }
.chat-msg__error button { padding: 2px 10px; border: 1px solid currentColor; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.chat-msg__error button:active { transform: scale(.96); }

/* 流式输出：闪烁光标与思考状态 */
.chat-caret { display: inline-block; width: 9px; height: 9px; margin-left: 4px; border-radius: 50%; background: var(--edge-text-primary); vertical-align: 1px; animation: chat-caret 1.2s ease-in-out infinite; }
@keyframes chat-caret { 50% { opacity: .3; transform: scale(.78); } }
.chat-msg.is-live .chat-msg__avatar .edge-ai-mark { animation: chat-mark 2.4s ease-in-out infinite; }
@keyframes chat-mark { 50% { transform: rotate(45deg) scale(.84); opacity: .7; } }
.chat-thinking { display: inline-flex; align-items: center; gap: 10px; min-height: 26px; color: var(--edge-text-secondary); font-size: 14px; }
.chat-thinking__dots { display: inline-flex; gap: 4px; }
.chat-thinking__dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--edge-primary); opacity: .3; animation: chat-dot 1.2s ease-in-out infinite; }
.chat-thinking__dots i:nth-child(2) { animation-delay: .15s; }
.chat-thinking__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-thinking__text { background: linear-gradient(90deg, var(--edge-text-muted) 0%, var(--edge-text-muted) 40%, var(--edge-text-primary) 50%, var(--edge-text-muted) 60%, var(--edge-text-muted) 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: chat-shimmer 2s linear infinite; }
@keyframes chat-shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.chat-steps { display: grid; gap: 4px; margin: 6px 0 0; padding: 0; list-style: none; color: var(--edge-text-muted); font-size: 13px; line-height: 20px; }
.chat-steps li { display: flex; align-items: center; gap: 8px; animation: chat-in 200ms var(--edge-ease-out) backwards; }
.chat-steps li i { width: 14px; text-align: center; font-size: 11px; }
.chat-steps li.is-done i { color: var(--edge-success); }
.chat-steps-done { display: flex; align-items: center; gap: 6px; margin: 2px 0 8px; color: var(--edge-text-muted); font-size: 12px; }

/* 引用来源：回答下方原位展开的来源列表；卡片由列表条目字段重新排版 */
.edge-modern .chat-sources { margin-top: 14px; }
.edge-modern .chat-sources__toggle { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; height: 30px; margin: 0; padding: 0 11px 0 5px; box-sizing: border-box; border: 1px solid var(--edge-border-light); border-radius: 999px; background: transparent; color: var(--edge-text-secondary); font: inherit; font-size: 13px; font-weight: 500; line-height: 1; cursor: pointer; transition: background-color 160ms var(--edge-ease-out), border-color 160ms var(--edge-ease-out), color 160ms var(--edge-ease-out); }
.edge-modern .chat-sources__toggle[aria-expanded="true"], .edge-modern .chat-sources__toggle:active { border-color: var(--edge-border); background: var(--edge-surface-hover); color: var(--edge-text-primary); }
@media (hover: hover) { .edge-modern .chat-sources__toggle:hover { border-color: var(--edge-border); background: var(--edge-surface-hover); color: var(--edge-text-primary); } }
.edge-modern .chat-sources__toggle:active { background: var(--edge-surface-active); }
.edge-modern .chat-sources__toggle:focus-visible { outline: 2px solid var(--edge-primary); outline-offset: 2px; }
.chat-sources__toggle > span:not(.chat-sources__avatars) { flex: none; }
.edge-modern .chat-sources__toggle small { min-width: 0; overflow: hidden; color: var(--edge-text-muted); font-size: 12px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.edge-modern .chat-sources__toggle small:empty { display: none; }
.chat-sources__toggle > i { flex: none; color: var(--edge-text-muted); font-size: 10px; transition: transform 200ms cubic-bezier(.2,0,0,1); }
.chat-sources__toggle[aria-expanded="true"] > i { transform: rotate(180deg); }
.chat-sources__avatars { display: inline-flex; flex: none; }
.chat-sources__avatars span { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; box-sizing: content-box; border: 2px solid var(--edge-bg); border-radius: 50%; color: #fff; font-size: 10px; font-weight: 600; line-height: 1; }
.chat-sources__avatars span + span { margin-left: -7px; }
.chat-sources__avatars i { font-size: 9px; }
.edge-modern .chat-references { margin: 0; padding: 0; list-style: none; }
.edge-modern .chat-references[hidden] { display: none; }
.edge-modern .chat-references > li { margin: 0; padding: 0; }
.edge-modern .chat-sources .chat-references { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 232px), 1fr)); gap: 8px; padding-top: 10px; }
.edge-modern .chat-sources .chat-ref { display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 0 8px; height: 100%; box-sizing: border-box; padding: 10px 12px 11px; border: 1px solid var(--edge-border-light); border-radius: 10px; background: transparent; color: var(--edge-text-primary) !important; text-decoration: none !important; transition: background-color 160ms var(--edge-ease-out), border-color 160ms var(--edge-ease-out); }
@media (hover: hover) { .edge-modern .chat-sources .chat-ref:hover { border-color: var(--edge-border); background: var(--edge-surface-hover); } }
.edge-modern .chat-sources .chat-ref:active { background: var(--edge-surface-active); }
.edge-modern .chat-sources li.is-linked .chat-ref { border-color: color-mix(in srgb, var(--edge-primary) 45%, transparent); background: color-mix(in srgb, var(--edge-primary) 6%, transparent); }
.chat-ref__mark { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; color: #fff; font-size: 10px; font-weight: 600; line-height: 1; }
.chat-ref__mark i { font-size: 9px; }
.chat-ref__main { display: grid; gap: 3px; min-width: 0; }
.chat-ref__src { display: flex; align-items: center; gap: 6px; min-width: 0; height: 20px; color: var(--edge-text-muted); font-size: 12px; line-height: 20px; }
.chat-ref__src > span { min-width: 0; overflow: hidden; color: var(--edge-text-secondary); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.chat-ref__src time { flex: none; }
.chat-ref__src time::before { content: "·"; margin-right: 6px; }
.chat-ref__src b, .chat-sources .chat-ref__snippet, .chat-sources .chat-ref__by { display: none; }
.chat-ref__title { display: -webkit-box; overflow: hidden; color: var(--edge-text-primary); font-size: 13px; font-weight: 500; line-height: 19px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.chat-ref__by img { width: 16px; height: 16px; border-radius: 50%; }

.edge-modern .chat-cite-pop { position: fixed; z-index: var(--edge-z-popover); box-sizing: border-box; width: min(360px, calc(100vw - 24px)); border: 1px solid var(--edge-border); border-radius: 12px; background: var(--edge-surface-raised, var(--edge-surface)); box-shadow: var(--edge-shadow-menu); transform-origin: var(--cite-x, 24px) top; animation: chat-pop-in 160ms cubic-bezier(.2,0,0,1) both; }
.edge-modern .chat-cite-pop.is-above { transform-origin: var(--cite-x, 24px) bottom; animation-name: chat-pop-up; }
.edge-modern .chat-cite-pop.is-switch { animation: none; }
.edge-modern .chat-cite-pop.edge-is-closing { animation: chat-pop-out 110ms ease-in forwards !important; pointer-events: none; }
@keyframes chat-pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes chat-pop-up { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes chat-pop-out { to { opacity: 0; transform: scale(.98); } }
.chat-cite-pop__card { overflow: hidden; border-radius: 11px; }
.chat-cite-card { display: grid; gap: 6px; padding: 12px 14px 10px 16px; }
.chat-cite-card__src { display: flex; align-items: center; gap: 8px; min-width: 0; height: 24px; color: var(--edge-text-muted); font-size: 12px; line-height: 24px; }
.chat-cite-pop:has(.chat-cite-pop__pager:not([hidden])) .chat-cite-card__src { padding-right: 84px; }
.chat-cite-card__name { min-width: 0; overflow: hidden; color: var(--edge-text-secondary); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.chat-cite-card__src time { flex: none; }
.chat-cite-card__src time::before { content: "·"; margin-right: 8px; }
.edge-modern .chat-cite-pop a.chat-cite-card__title { display: -webkit-box; overflow: hidden; color: var(--edge-text-primary) !important; font-size: 15px; font-weight: 600; line-height: 22px; text-decoration: none !important; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; transition: color 140ms var(--edge-ease-out); }
.edge-modern .chat-cite-pop a.chat-cite-card__title:hover { color: var(--edge-link, var(--edge-primary)) !important; }
.edge-modern .chat-cite-pop p.chat-cite-card__snippet { display: -webkit-box; margin: 0; padding: 0; overflow: hidden; color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow-wrap: anywhere; }
.chat-cite-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--edge-border-light); }
.chat-cite-card__by { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--edge-text-muted); font-size: 12px; line-height: 18px; }
.edge-modern .chat-cite-card__by img { flex: none; width: 18px; height: 18px; margin: 0; border-radius: 50%; object-fit: cover; background: var(--edge-surface-active); }
.chat-cite-card__by span { min-width: 0; overflow: hidden; color: var(--edge-text-secondary); text-overflow: ellipsis; white-space: nowrap; }
.chat-cite-card__by em { flex: none; padding: 0 6px; border-radius: 4px; background: var(--edge-surface-hover); font-style: normal; font-size: 11px; line-height: 17px; }
.edge-modern .chat-cite-pop a.chat-cite-card__open { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 28px; margin-right: -6px; padding: 0 8px; border-radius: 6px; color: var(--edge-text-secondary) !important; font-size: 12px; font-weight: 500; text-decoration: none !important; transition: background-color 140ms var(--edge-ease-out), color 140ms var(--edge-ease-out); }
.chat-cite-card__open i { font-size: 10px; }
.edge-modern .chat-cite-pop a.chat-cite-card__open:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary) !important; }
.edge-modern .chat-cite-pop a.chat-cite-card__open:active { background: var(--edge-surface-active); }
.chat-cite-pop__pager { position: absolute; top: 11px; right: 8px; z-index: 1; display: flex; align-items: center; gap: 0; color: var(--edge-text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chat-cite-pop__pager[hidden] { display: none; }
.chat-cite-pop__pager span { min-width: 32px; text-align: center; }
.edge-modern .chat-cite-pop__pager button { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; min-height: 0; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--edge-text-secondary); font-size: 10px; cursor: pointer; transition: background-color 140ms var(--edge-ease-out); }
.edge-modern .chat-cite-pop__pager button:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.edge-modern .chat-cite-pop__pager button:active { background: var(--edge-surface-active); }
@media (max-width: 560px) { .edge-modern .chat-sources__toggle small { display: none; } }
@media (prefers-reduced-motion: reduce) { .edge-modern .chat-cite-pop, .edge-modern .chat-cite-pop.edge-is-closing { animation: none !important; } .chat-sources__toggle > i { transition: none; } }
.chat-msg__actions { display: flex; gap: 2px; margin: 8px 0 0 -6px; opacity: .9; }
.chat-msg__actions [hidden] { display: none; }

/* 欢迎页与建议 */
.chat-welcome { display: flex; flex-direction: column; align-items: center; padding: 8vh 0 8px; text-align: center; animation: chat-in 300ms var(--edge-ease-out) both; }
.chat-welcome__mark { width: 44px; height: 44px; margin-bottom: 16px; font-size: 18px; }
.chat-app .chat-welcome h2 { margin: 0 0 8px; font-size: 22px; font-weight: 600; line-height: 30px; }
.chat-app .chat-welcome > p { margin: 0; color: var(--edge-text-secondary); font-size: 14px; line-height: 22px; }
.chat-app .chat-welcome > .chat-welcome__note { margin-top: 2px; color: var(--edge-text-muted); font-size: 12px; line-height: 18px; }
.chat-suggest__item.is-personal small { color: var(--edge-primary); }
.chat-welcome.is-leaving { animation: chat-out 160ms ease both; }
@keyframes chat-out { to { opacity: 0; transform: translateY(-6px); } }
.chat-suggest { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; width: 100%; margin-top: 28px; text-align: left; }
.chat-suggest__item { display: flex; align-items: flex-start; gap: 12px; min-width: 0; padding: 14px; border: 1px solid var(--edge-border-light); border-radius: 10px; background: var(--edge-surface); color: var(--edge-text-primary); font: inherit; text-align: left; cursor: pointer; transition: border-color var(--edge-transition-fast), background-color var(--edge-transition-fast), transform 90ms ease; }
.chat-suggest__item > i { flex: none; width: 16px; margin-top: 3px; color: var(--edge-text-muted); text-align: center; transition: color var(--edge-transition-fast); }
.chat-suggest__item span { display: grid; gap: 2px; min-width: 0; }
.chat-suggest__item strong { font-size: 14px; font-weight: 600; line-height: 20px; }
.chat-suggest__item small { color: var(--edge-text-muted); font-size: 12px; line-height: 18px; }
.chat-suggest__item:hover { border-color: var(--edge-border); background: var(--chat-tint); }
.chat-suggest__item:hover > i { color: var(--edge-primary); }
.chat-suggest__item:active { transform: scale(.985); background: var(--edge-surface-hover); }
.chat-suggest__item:disabled { opacity: .5; cursor: progress; }

.chat-jump { position: absolute; top: -46px; left: 50%; z-index: 2; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin-left: -17px; padding: 0; border: 1px solid var(--edge-border); border-radius: 50%; background: var(--edge-surface); color: var(--edge-text-secondary); box-shadow: var(--edge-shadow-menu); cursor: pointer; animation: chat-in 180ms var(--edge-ease-out) both; }
.chat-jump[hidden] { display: none; }
.chat-jump:hover { color: var(--edge-text-primary); }
.chat-jump:active { transform: scale(.92); }

/* 输入框 */
.chat-composer { position: sticky; bottom: 0; z-index: 5; box-sizing: border-box; width: 100%; max-width: var(--chat-col); margin: 0 auto; padding: 18px 0 12px; background: linear-gradient(to bottom, transparent, var(--edge-bg) 18px); }
.chat-box { position: relative; border: 1px solid var(--edge-border); border-radius: 16px; background: var(--edge-surface); box-shadow: 0 2px 10px rgba(16,24,40,.06); transition: border-color var(--edge-transition-fast), box-shadow var(--edge-transition-fast); }
.chat-box.is-focus { border-color: color-mix(in srgb, var(--edge-primary) 55%, var(--edge-border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--edge-primary) 18%, transparent); }
.chat-app .chat-box textarea { display: block; box-sizing: border-box; width: 100%; min-height: 52px; max-height: 220px; margin: 0; padding: 14px 16px 6px; overflow-y: auto; border: 0; border-radius: 16px 16px 0 0; outline: 0; background: transparent; color: var(--edge-text-primary); font: inherit; font-size: 15px; line-height: 24px; resize: none; box-shadow: none; }
.chat-app .chat-box textarea:focus-visible { outline: 0; }
.chat-box textarea::placeholder { color: var(--edge-text-muted); }
.chat-box__bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px 10px; }
.chat-box__opts { display: flex; flex: 1; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chat-pick { position: relative; display: inline-flex; min-width: 0; max-width: 220px; }
.chat-pick__btn { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; outline: 0; background: transparent; color: var(--edge-text-secondary); font: inherit; font-size: 13px; cursor: pointer; transition: background-color var(--edge-transition-fast), color var(--edge-transition-fast); -webkit-tap-highlight-color: transparent; }
.chat-pick__btn > i:first-child { flex: none; color: var(--edge-text-muted); font-size: 11px; }
.chat-pick__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pick__caret { flex: none; font-size: 9px; color: var(--edge-text-muted); transition: transform var(--edge-transition-fast); }
.chat-pick__btn:hover:not(:disabled), .chat-pick__btn[aria-expanded="true"] { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-pick__btn:active:not(:disabled) { background: var(--edge-surface-active); }
.chat-app .chat-pick__btn { font-size: 13px; line-height: 18px; }
.chat-pick__btn[aria-expanded="true"] .chat-pick__caret { transform: rotate(180deg); }
.chat-app .chat-pick__btn:focus { outline: 0; box-shadow: none; }
.chat-app .chat-pick__btn:focus-visible { outline: 2px solid var(--edge-primary); outline-offset: 1px; }
.chat-pick__btn:disabled { cursor: default; color: var(--edge-text-muted); }
.chat-pick__btn:disabled .chat-pick__caret { display: none; }
.chat-pick > select:not(.chat-sr) { max-width: 100%; height: 30px; border: 1px solid var(--edge-border-light); border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: 13px; }
.chat-pick > i { display: none; }
.chat-menu { position: absolute; bottom: calc(100% + 8px); left: 0; z-index: var(--edge-z-popover); display: grid; gap: 1px; width: max-content; min-width: 220px; max-width: min(320px, calc(100vw - 32px)); max-height: min(360px, 50vh); padding: 6px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--edge-border); border-radius: 12px; background: var(--edge-surface-raised); box-shadow: var(--edge-shadow-menu); transform-origin: bottom left; animation: chat-menu-in 140ms var(--edge-ease-out) both; scrollbar-width: thin; }
.chat-menu.is-closing { animation: chat-menu-out 120ms ease both; }
@keyframes chat-menu-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes chat-menu-out { to { opacity: 0; transform: translateY(4px); } }
.chat-app .chat-menu__group { margin: 8px 10px 4px; color: var(--edge-text-muted); font-size: 12px; font-weight: 600; }
.chat-menu__item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 8px; outline: 0; background: transparent; color: var(--edge-text-primary); font: inherit; text-align: left; cursor: pointer; }
.chat-menu__item:hover, .chat-menu__item:focus-visible { background: var(--edge-surface-hover); }
.chat-menu__item:active { background: var(--edge-surface-active); }
.chat-menu__text { display: grid; flex: 1; gap: 1px; min-width: 0; }
.chat-menu__text strong { overflow: hidden; font-size: 13px; font-weight: 500; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }
.chat-menu__text small { color: var(--edge-text-muted); font-size: 12px; line-height: 17px; }
.chat-menu__check { flex: none; color: var(--edge-primary); font-size: 12px; visibility: hidden; }
.chat-menu__item[aria-selected="true"] .chat-menu__check { visibility: visible; }
.chat-menu__item[aria-selected="true"] strong { font-weight: 600; }
/* 公开开关 */
.chat-switch { display: inline-flex; flex: none; align-items: center; gap: 8px; height: 30px; padding: 0 4px 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--edge-text-secondary); font: inherit; font-size: 12px; cursor: pointer; transition: background-color var(--edge-transition-fast); }
.chat-switch:hover:not(:disabled) { background: var(--edge-surface-hover); }
.chat-switch:disabled { color: var(--edge-text-disabled); cursor: not-allowed; }
.chat-switch.is-busy { cursor: progress; }
.chat-switch__track { position: relative; display: inline-block; width: 34px; height: 20px; border-radius: 999px; background: var(--edge-border); transition: background-color 180ms var(--edge-ease-out); }
.chat-switch__track b { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform 200ms var(--edge-ease-out), width 120ms ease; }
.chat-switch:active:not(:disabled) .chat-switch__track b { width: 19px; }
.chat-switch[aria-checked="true"] .chat-switch__track { background: var(--edge-success); }
.chat-switch[aria-checked="true"] .chat-switch__track b { transform: translateX(14px); }
.chat-switch[aria-checked="true"]:active:not(:disabled) .chat-switch__track b { transform: translateX(11px); }
.chat-switch[aria-checked="true"] span { color: var(--edge-text-primary); }
.chat-switch:disabled .chat-switch__track { opacity: .5; }
.chat-box__bar [data-edge-tip]::after { left: auto; right: 0; transform: translateY(3px); }
.chat-box__bar [data-edge-tip]:hover::after { transform: none; }
.chat-box__bar .chat-pick[data-edge-tip]::after { left: 0; right: auto; }
.chat-send { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: var(--edge-text-primary); color: var(--edge-surface); font-size: 14px; cursor: pointer; transition: opacity var(--edge-transition-fast), transform 90ms ease, background-color var(--edge-transition-fast); }
.chat-send:hover:not(:disabled) { opacity: .85; }
.chat-send:active:not(:disabled) { transform: scale(.9); }
.chat-send:disabled { background: var(--edge-border); color: var(--edge-surface); cursor: not-allowed; }
.chat-send[hidden] { display: none; }
.chat-send--stop { animation: chat-in 160ms var(--edge-ease-out) both; }
.chat-send--stop i { font-size: 11px; }
.chat-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 22px; padding: 6px 4px 0; color: var(--edge-text-muted); font-size: 12px; line-height: 18px; }
.chat-app .chat-status { order: 3; flex-basis: 100%; }
.chat-app .chat-status:empty { display: none; }
.chat-app .chat-status:not(.is-error) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat-app .chat-status.is-error { color: var(--edge-danger); }
.chat-app .chat-foot .chat-disclaimer { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 0 auto; color: var(--edge-text-muted); font-size: 12px; line-height: 18px; white-space: nowrap; }
.chat-app .chat-disclaimer a { color: inherit; text-decoration: underline; text-decoration-color: var(--edge-border); text-underline-offset: 2px; }
.chat-app .chat-disclaimer a:hover { color: var(--edge-text-primary); text-decoration-color: currentColor; }
.chat-link-btn { padding: 0; border: 0; background: transparent; color: var(--edge-primary); font: inherit; cursor: pointer; }
.chat-link-btn:hover { text-decoration: underline; }
.chat-link-btn:active { opacity: .7; }
.chat-gate { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; padding: 16px 24px 20px; border-top: 1px solid var(--edge-border-light); background: var(--edge-bg); color: var(--edge-text-secondary); font-size: 14px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .chat-app *, .chat-app *::before { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .chat-thinking__text { color: var(--edge-text-secondary); background: none; }
}
@media (max-width: 1100px) { .chat-app { --chat-side-w: 220px; gap: 0 20px; } }
@media (max-width: 900px) {
  .chat-app { --chat-top: calc(var(--edge-header-height) + 8px); grid-template-columns: minmax(0,1fr); }
  .chat-side { position: fixed; top: var(--edge-header-height); bottom: 0; left: 0; z-index: var(--edge-z-modal); width: min(300px,84vw); height: auto; border: 0; border-radius: 0; background: var(--edge-surface); box-shadow: var(--edge-shadow-dialog); transform: translateX(-104%); visibility: hidden; transition: transform 240ms var(--edge-ease-out), visibility 0s linear 240ms; }
  .chat-app.is-side-open .chat-side { transform: none; visibility: visible; transition: transform 240ms var(--edge-ease-out); }
  .chat-side .chat-side__close { display: inline-flex; }
  .chat-side__scrim { position: fixed; inset: var(--edge-header-height) 0 0; z-index: calc(var(--edge-z-modal) - 1); display: block; background: rgba(0,0,0,.36); opacity: 0; transition: opacity 200ms ease; }
  .chat-side__scrim[hidden] { display: none; }
  .chat-app.is-side-open .chat-side__scrim { opacity: 1; }
  .chat-bar { gap: 6px; min-height: 52px; margin-top: -16px; padding: 6px 0; }
  .chat-bar .chat-bar__menu { display: inline-flex; width: 36px; height: 36px; }
  .chat-tool-btn span { display: none; }
  .chat-thread { padding: 18px 0 24px; }
  .chat-composer { padding: 14px 0 8px; }
  .chat-suggest { grid-template-columns: minmax(0,1fr); margin-top: 20px; }
  .chat-welcome { padding-top: 4vh; }
  .chat-msg--assistant { grid-template-columns: minmax(0,1fr); gap: 4px; }
  .chat-msg__avatar { display: none; }
  .chat-msg__bubble { max-width: 90%; }
  .chat-icon-btn { width: 36px; height: 36px; }
  .chat-app .chat-box textarea { font-size: 16px; }
}
.chat-unavailable { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 12vh 16px; text-align: center; }
.chat-unavailable__mark { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: 16px; border-radius: 50%; background: var(--edge-primary-low); color: var(--edge-primary); font-size: 18px; }
.chat-unavailable h1 { margin: 0 0 8px; font-size: 22px; line-height: 30px; }
.chat-unavailable p { margin: 0 0 20px; color: var(--edge-text-secondary); }
.chat-unavailable__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chat-unavailable .chat-thinking__dots { display: inline-flex; gap: 4px; }
.chat-unavailable .chat-thinking__dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--edge-primary); opacity: .3; animation: chat-dot 1.2s ease-in-out infinite; }
.chat-unavailable .chat-thinking__dots i:nth-child(2) { animation-delay: .15s; }
.chat-unavailable .chat-thinking__dots i:nth-child(3) { animation-delay: .3s; }
.chat-side__scroll { overflow-x: hidden; }
.edge-modern .chat-app .chat-msg__body blockquote { background: transparent; border-left: 3px solid var(--edge-border); }
.edge-modern .chat-app .chat-msg__body .edge-codeblock { margin: 0 0 12px; }

/* 思考与检索过程 */
.chat-process { margin: 2px 0 10px; }
.chat-process > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 8px 0 4px; border-radius: 6px; color: var(--edge-text-muted); font-size: 13px; list-style: none; cursor: pointer; user-select: none; transition: color var(--edge-transition-fast), background-color var(--edge-transition-fast); }
.chat-process > summary::-webkit-details-marker { display: none; }
.chat-process > summary:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-process > summary:active { background: var(--edge-surface-active); }
.chat-process__arrow { width: 12px; font-size: 10px; text-align: center; transition: transform var(--edge-transition-fast); }
.chat-process[open] > summary .chat-process__arrow { transform: rotate(90deg); }
.chat-process.is-live > summary span { background: linear-gradient(90deg, var(--edge-text-muted) 0%, var(--edge-text-muted) 40%, var(--edge-text-primary) 50%, var(--edge-text-muted) 60%, var(--edge-text-muted) 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: chat-shimmer 2s linear infinite; }
.chat-app .chat-process__list { position: relative; display: grid; gap: 10px; margin: 6px 0 4px 10px; padding: 2px 0 2px 16px; border-left: 1px solid var(--edge-border-light); list-style: none; animation: chat-in 180ms var(--edge-ease-out) both; }
.chat-process__list > li { display: grid; grid-template-columns: 16px minmax(0,1fr); gap: 8px; min-width: 0; color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; animation: chat-in 200ms var(--edge-ease-out) backwards; }
.chat-process__list > li > i { margin-top: 3px; color: var(--edge-text-muted); font-size: 11px; text-align: center; }
.chat-process__list > li.is-pending > i { color: var(--edge-primary); }
.chat-process__list:empty { display: none; }
.chat-process__time { color: var(--edge-text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chat-process__time:empty { display: none; }
.chat-process.is-bare > summary { cursor: default; }
.chat-process.is-bare > summary:hover, .chat-process.is-bare > summary:active { background: transparent; color: var(--edge-text-muted); }
.chat-process.is-bare .chat-process__arrow { display: none; }
.chat-process__think > div { color: var(--edge-text-muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-process.is-live .chat-process__think > div { display: flex; flex-direction: column-reverse; max-height: 100px; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 32px); mask-image: linear-gradient(to bottom, transparent, #000 32px); }
.chat-app .chat-process__tool p { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 0; }
.chat-process__tool strong { color: var(--edge-text-primary); font-weight: 500; }
.chat-process__tool q { color: var(--edge-text-secondary); quotes: "“" "”"; }
.chat-process__tool small { color: var(--edge-text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chat-app .chat-process__tool ul { display: grid; gap: 0; margin: 4px 0 0; padding: 0; list-style: none; }
.chat-process__tool ul a { display: block; overflow: hidden; color: var(--edge-text-muted); font-size: 12px; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }
.chat-process__tool ul a:hover { color: var(--edge-primary); }
.chat-usage { margin-left: auto; padding-left: 12px; align-self: center; color: var(--edge-text-muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chat-msg__actions { align-items: center; }
@media (max-width: 600px) { .chat-usage { flex-basis: 100%; margin-left: 6px; padding-left: 0; } .chat-msg__actions { flex-wrap: wrap; } }
/* 额度条 */
.chat-quota { position: relative; display: inline-flex; font-variant-numeric: tabular-nums; }
.chat-quota__chip { display: inline-flex; align-items: center; gap: 8px; height: 24px; margin-left: -6px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--edge-text-muted); font: inherit; font-size: 12px; cursor: pointer; transition: background-color var(--edge-transition-fast), color var(--edge-transition-fast); }
.chat-quota__chip:hover, .chat-quota__chip[aria-expanded="true"] { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-quota__chip:active { background: var(--edge-surface-active); }
.chat-quota__chip:focus-visible { outline: 2px solid var(--edge-primary); outline-offset: 1px; }
.chat-quota__meter { position: relative; display: inline-block; width: 28px; height: 4px; overflow: hidden; border-radius: 999px; background: var(--edge-border-light); }
.chat-quota__meter b { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--edge-text-muted); transition: width 400ms var(--edge-ease-out); }
.chat-quota.is-low .chat-quota__meter b { background: var(--edge-warning); }
.chat-quota.is-low [data-chat-quota] { color: var(--edge-warning); }
.chat-quota__warn { color: var(--edge-warning); }
.chat-quota__warn::before { content: "·"; margin-right: 8px; color: var(--edge-text-muted); }
.chat-quota__panel { position: absolute; bottom: calc(100% + 8px); left: -6px; z-index: var(--edge-z-popover); box-sizing: border-box; width: 280px; max-width: calc(100vw - 32px); padding: 14px 16px; border: 1px solid var(--edge-border); border-radius: 12px; background: var(--edge-surface-raised); box-shadow: var(--edge-shadow-menu); color: var(--edge-text-primary); white-space: normal; transform-origin: bottom left; animation: chat-menu-in 140ms var(--edge-ease-out) both; }
.chat-quota__panel[hidden] { display: none; }
.chat-quota__panel.edge-is-closing { animation: chat-menu-out 120ms ease both; }
.chat-quota__panel dl { display: grid; gap: 8px; margin: 0; }
.chat-quota__panel dl > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; line-height: 20px; }
.chat-quota__panel dt { color: var(--edge-text-secondary); }
.chat-quota__panel dd { margin: 0; font-weight: 500; }
.chat-app .chat-quota__note { margin: 10px 0 0; color: var(--edge-text-muted); font-size: 12px; line-height: 18px; }
.chat-quota__actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.chat-quota__actions:empty { display: none; }
.chat-app .chat-quota__actions .edge-button { padding: 5px 12px; font-size: 13px; }
.chat-quota__actions a { margin-left: auto; color: var(--edge-text-secondary); font-size: 13px; }
.chat-quota__actions a:hover { color: var(--edge-primary); }

/* 兑换弹窗（挂在 body 上，不依赖 .chat-app） */
.chat-exchange .edge-dialog__container { width: min(440px, 100%); }
.edge-modern .chat-exchange .edge-dialog__header h2 { font-size: 18px; font-weight: 600; }
.edge-modern .chat-exchange .edge-dialog__body { padding: 16px 24px 20px; font-size: 14px; }
.edge-modern .chat-exchange .chat-exchange__lead { margin: 0 0 16px; color: var(--edge-text-secondary); font-size: 14px; line-height: 22px; }
.chat-exchange__facts { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); margin: 0 0 20px; border: 1px solid var(--edge-border-light); border-radius: 10px; }
.chat-exchange__facts > div { min-width: 0; padding: 10px 12px; }
.chat-exchange__facts > div + div { border-left: 1px solid var(--edge-border-light); }
.chat-exchange__facts dt { margin: 0 0 2px; color: var(--edge-text-muted); font-size: 12px; line-height: 16px; }
.chat-exchange__facts dd { margin: 0; color: var(--edge-text-primary); font-size: 14px; font-weight: 600; line-height: 20px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.edge-modern .chat-exchange .chat-exchange__label { margin: 0 0 8px; color: var(--edge-text-primary); font-size: 14px; font-weight: 600; }
.chat-exchange__presets { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-bottom: 10px; }
.chat-exchange__preset { height: 36px; padding: 0 6px; border: 1px solid var(--edge-border); border-radius: 8px; background: var(--edge-surface); color: var(--edge-text-primary); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; transition: border-color var(--edge-transition-fast), background-color var(--edge-transition-fast), color var(--edge-transition-fast), transform 90ms ease; }
.chat-exchange__preset:hover:not(:disabled) { border-color: var(--edge-text-muted); background: var(--edge-surface-hover); }
.chat-exchange__preset:active:not(:disabled) { transform: scale(.97); }
.chat-exchange__preset[aria-pressed="true"] { border-color: var(--edge-primary); background: var(--edge-primary-low); color: var(--edge-primary); font-weight: 600; }
.chat-exchange__preset:disabled { color: var(--edge-text-disabled); cursor: not-allowed; }
.chat-exchange__preset:focus-visible, .chat-exchange__step:focus-visible { outline: 2px solid var(--edge-primary); outline-offset: 2px; }
.chat-exchange__field { display: flex; align-items: center; height: 40px; border: 1px solid var(--edge-border); border-radius: 8px; background: var(--edge-surface); transition: border-color var(--edge-transition-fast), box-shadow var(--edge-transition-fast); }
.chat-exchange__field:focus-within { border-color: var(--edge-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--edge-primary) 18%, transparent); }
.edge-modern .chat-exchange__field input { flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0 4px; border: 0; outline: 0; background: transparent; box-shadow: none; color: var(--edge-text-primary); font: inherit; font-size: 16px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.chat-exchange__field input::-webkit-outer-spin-button, .chat-exchange__field input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.chat-exchange__unit { flex: none; padding-right: 8px; color: var(--edge-text-muted); font-size: 13px; }
.chat-exchange__step { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 40px; height: 100%; padding: 0; border: 0; background: transparent; color: var(--edge-text-secondary); font-size: 12px; cursor: pointer; transition: background-color var(--edge-transition-fast); }
.chat-exchange__step:first-child { border-right: 1px solid var(--edge-border-light); border-radius: 8px 0 0 8px; }
.chat-exchange__step:last-child { border-left: 1px solid var(--edge-border-light); border-radius: 0 8px 8px 0; }
.chat-exchange__step:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-exchange__step:active { background: var(--edge-surface-active); }
.chat-exchange__result { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 18px 0 6px; color: var(--edge-text-secondary); font-size: 13px; }
.chat-exchange__result strong { color: var(--edge-text-primary); font-size: 26px; font-weight: 600; line-height: 32px; font-variant-numeric: tabular-nums; }
.edge-modern .chat-exchange .chat-exchange__hint { margin: 0; color: var(--edge-text-muted); font-size: 12px; line-height: 18px; text-align: center; }
.edge-modern .chat-exchange .chat-exchange__hint.is-error { color: var(--edge-danger); }
.chat-exchange [data-submit].is-busy { cursor: progress; opacity: .8; }
@media (max-width: 520px) {
  .chat-exchange__facts { grid-template-columns: minmax(0,1fr); }
  .chat-exchange__facts > div + div { border-left: 0; border-top: 1px solid var(--edge-border-light); }
  .chat-exchange__facts > div { display: flex; justify-content: space-between; gap: 12px; }
  .chat-exchange__presets { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
.chat-app .chat-msg__body > div > :first-child { margin-top: 0; }
.chat-app .chat-msg__body > div > :last-child { margin-bottom: 0; }

/* 个人设置沿用论坛表单与主题变量，长内容在窄屏内换行。 */
.chat-settings { overflow-wrap: anywhere; }
.chat-settings__form { display: grid; gap: 12px; }
.chat-settings__form label { font-size: 14px; line-height: 20px; }
.chat-settings__form textarea, .chat-settings__form input[type=text], .chat-settings__form select { box-sizing: border-box; width: 100%; min-width: 0; padding: 8px 12px; border: 1px solid var(--edge-border); border-radius: 4px; color: var(--edge-text-primary); background: var(--edge-bg); font: inherit; font-size: 16px; line-height: 24px; }
.chat-settings__form textarea { resize: vertical; }
.chat-settings__form textarea:hover, .chat-settings__form input:hover, .chat-settings__form select:hover { border-color: var(--edge-text-muted); }
.chat-settings__form textarea:focus-visible, .chat-settings__form select:focus-visible { outline: 2px solid var(--edge-primary); outline-offset: 2px; }
.chat-settings__form > button { justify-self: start; }
[data-chat-token-once] { min-width: 0; white-space: normal; overflow-wrap: anywhere; }

.chat-settings__rules { overflow-wrap: anywhere; white-space: pre-wrap; padding: 16px; border: 1px solid var(--edge-border-light); border-radius: 4px; background: var(--edge-bg); font-size: 14px; line-height: 20px; }
.chat-settings__tools { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--edge-border-light); border-radius: 4px; }
.chat-settings__tools label { display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
@media(max-width:600px) { .chat-settings__tools { grid-template-columns: minmax(0,1fr); } }

/* 标题生成后轻微淡入，提示会话已命名。 */
@keyframes chat-title-in { from { opacity: .2; } }
.chat-bar h1.is-titled { animation: chat-title-in 360ms var(--edge-ease-out) both; }
@media (prefers-reduced-motion: reduce) { .chat-bar h1.is-titled { animation: none; } }

/* AI 设置页（角色广场、我的记忆、访问令牌）：统一页头、二级导航与列表行，控件沿用 38px/14px 基准。 */
.edge-chat.chat-set { display: block; max-width: 960px; color: var(--edge-text-primary); overflow-wrap: break-word; }
.chat-set p { margin: 0; }
.chat-set__nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--edge-border-light); }
.chat-set__back { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 0; color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; text-decoration: none; }
.chat-set__back:hover { color: var(--edge-text-primary); }
.chat-set__tabs { display: flex; gap: 4px; margin-left: auto; }
.chat-set__tabs a { padding: 5px 12px; border-radius: 6px; color: var(--edge-text-secondary); font-size: 14px; line-height: 22px; text-decoration: none; transition: background-color var(--edge-transition-fast), color var(--edge-transition-fast); }
.chat-set__tabs a:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-set__tabs a:active { background: var(--edge-surface-active); }
.chat-set__tabs a[aria-current] { background: var(--edge-surface-active); color: var(--edge-text-primary); font-weight: 600; }
.chat-set__head { margin-bottom: 24px; }
.edge-chat.chat-set h1 { margin: 0 0 8px; font-size: 26px; line-height: 34px; font-weight: 600; }
.chat-set .chat-set__lead { color: var(--edge-text-secondary); font-size: 14px; line-height: 22px; text-wrap: pretty; }
.chat-set__lead a { margin-left: 4px; color: var(--edge-primary); white-space: nowrap; }
.chat-set__lead a:hover { text-decoration: underline; }
.chat-set__section { margin-top: 32px; }
.chat-set__section:first-of-type { margin-top: 0; }
.chat-set__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.edge-chat.chat-set .chat-set__row .chat-set__title { margin: 0; }
.edge-chat.chat-set .chat-set__title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 12px; font-size: 16px; line-height: 24px; font-weight: 600; }
.chat-set__title small { color: var(--edge-text-muted); font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; }
.chat-set .chat-set__hint { color: var(--edge-text-muted); font-size: 13px; line-height: 20px; text-wrap: pretty; }
.chat-set .chat-set__empty { padding: 4px 0 8px; color: var(--edge-text-muted); font-size: 14px; line-height: 22px; text-wrap: pretty; }

/* 角色卡片：无边框，悬停换底色，整张可点。 */
.chat-persona-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 4px 12px; }
.chat-persona-card { display: grid; grid-template-columns: 40px minmax(0,1fr) 16px; align-items: start; gap: 14px; padding: 14px; border-radius: 10px; color: var(--edge-text-primary); text-decoration: none; transition: background-color var(--edge-transition-fast); }
.chat-persona-card:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-persona-card:active { background: var(--edge-surface-active); }
.chat-persona-card__icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: var(--edge-primary-low); color: var(--edge-primary); font-size: 16px; }
.chat-persona-card__body { display: grid; gap: 4px; min-width: 0; }
.chat-persona-card__body strong { display: flex; align-items: center; gap: 8px; font-size: 15px; line-height: 22px; font-weight: 600; }
.chat-persona-card__body em { padding: 0 6px; border-radius: 4px; background: var(--edge-surface-active); color: var(--edge-text-secondary); font-size: 11px; font-style: normal; font-weight: 500; line-height: 18px; }
.chat-persona-card__intro { color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat-persona-card__body small, .chat-set__item-main small { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; color: var(--edge-text-muted); font-size: 12px; line-height: 18px; font-variant-numeric: tabular-nums; }
.chat-persona-card__body small span + span::before, .chat-set__item-main small > span + span::before { content: "·"; margin: 0 6px; }
.chat-persona-card__go { align-self: center; color: var(--edge-text-muted); font-size: 12px; opacity: 0; transform: translateX(-4px); transition: opacity var(--edge-transition-fast), transform var(--edge-transition-fast); }
.chat-persona-card:hover .chat-persona-card__go, .chat-persona-card:focus-visible .chat-persona-card__go { opacity: 1; transform: none; }

/* 列表行：我的角色、记忆、令牌共用。 */
.chat-set__list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--edge-border-light); }
.chat-set__item { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 12px 4px; border-bottom: 1px solid var(--edge-border-light); }
.chat-set__item.is-current { background: var(--chat-set-tint, var(--edge-surface-hover)); }
.chat-set__item.is-muted { opacity: .6; }
.chat-set__item .chat-persona-card__icon { flex: none; width: 34px; height: 34px; border-radius: 8px; font-size: 14px; }
.chat-set__item-main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.chat-set__item-main strong { overflow: hidden; font-size: 14px; line-height: 22px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.chat-set__item-actions { display: flex; flex: none; align-items: center; gap: 4px; }
.chat-set__pill { padding: 0 6px; border-radius: 4px; background: var(--edge-surface-active); color: var(--edge-text-secondary); font-size: 11px; line-height: 18px; }
.chat-set__pill--public { background: color-mix(in srgb, var(--edge-success) 14%, transparent); color: var(--edge-success); }
.chat-set__pill--pending { background: var(--edge-warning-low); color: var(--edge-warning); }
.chat-set__item-main small > .chat-set__pill + span::before { margin-left: 8px; }
.chat-set__link { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--edge-text-secondary); font-family: inherit; font-size: 13px; line-height: 20px; text-decoration: none; cursor: pointer; transition: background-color var(--edge-transition-fast), color var(--edge-transition-fast); }
.chat-set__link:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-set__link:active { background: var(--edge-surface-active); }
.chat-set__link--danger:hover { background: var(--edge-danger-low); color: var(--edge-danger); }
.chat-set__link[hidden] { display: none; }
.chat-set__btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid var(--edge-border); border-radius: 6px; color: var(--edge-text-primary); font-size: 13px; font-weight: 600; text-decoration: none; transition: background-color var(--edge-transition-fast); }
.chat-set__btn:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-set__btn:active { background: var(--edge-surface-active); }
.chat-set__btn i { font-size: 12px; }

/* 输入：新增记忆、创建令牌。 */
.chat-set__note { display: flex; gap: 10px; margin-bottom: 20px; padding: 12px 14px; border-radius: 8px; background: var(--edge-surface-hover); color: var(--edge-text-secondary); font-size: 13px; line-height: 21px; }
.chat-set .chat-set__note p { font-size: inherit; line-height: inherit; }
.chat-set__note i { margin-top: 4px; color: var(--edge-text-muted); }
.chat-set__note code, .chat-set__hint code { padding: 1px 5px; border-radius: 4px; background: var(--edge-surface-active); color: var(--edge-text-primary); font-size: 12px; }
.chat-set__compose { margin-bottom: 32px; border: 1px solid var(--edge-border); border-radius: 10px; background: var(--edge-surface); transition: border-color var(--edge-transition-fast), box-shadow var(--edge-transition-fast); }
.chat-set__compose:focus-within { border-color: var(--edge-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--edge-primary) 18%, transparent); }
.edge-modern .chat-set .chat-set__compose textarea { display: block; border-radius: 0; box-shadow: none; box-sizing: border-box; width: 100%; min-height: 64px; padding: 12px 14px 4px; border: 0; outline: 0; background: transparent; color: var(--edge-text-primary); font-family: inherit; font-size: 14px; line-height: 22px; resize: none; }
.chat-set__compose-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 6px 8px 8px 14px; }
.chat-set__compose-bar small { margin-right: auto; color: var(--edge-text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chat-set__compose--inline { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 0; }
.edge-modern .chat-set .chat-set__compose--inline input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border: 0; border-radius: 0; outline: 0; box-shadow: none; background: transparent; color: var(--edge-text-primary); font-family: inherit; font-size: 14px; }
.chat-set__compose .edge-button, .chat-set__actions .edge-button, .chat-set__callout .edge-button, .chat-set__once .edge-button { min-height: 34px; padding: 0 14px; font-size: 14px; }
.chat-set :is(textarea, input)::placeholder { color: var(--edge-text-muted); }

/* 记忆行：文本即编辑框，修改后才出现保存。 */
.chat-set__memory form { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: start; gap: 12px; width: 100%; }
.chat-set__memory { padding: 8px 4px; }
.chat-set__num { padding-top: 7px; color: var(--edge-text-muted); font-size: 12px; line-height: 20px; font-variant-numeric: tabular-nums; }
.chat-set__memory textarea { box-sizing: border-box; width: 100%; min-height: 34px; padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--edge-text-primary); font-family: inherit; font-size: 14px; line-height: 22px; resize: none; overflow: hidden; field-sizing: content; transition: border-color var(--edge-transition-fast), background-color var(--edge-transition-fast); }
.chat-set__memory textarea:hover { background: var(--edge-surface-hover); }
.chat-set__memory textarea:focus { border-color: var(--edge-primary); outline: 0; background: var(--edge-surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--edge-primary) 18%, transparent); }
.chat-set__memory .chat-set__item-actions { padding-top: 2px; }

/* 角色表单 */
.chat-set__form { display: grid; gap: 18px; padding-top: 24px; border-top: 1px solid var(--edge-border-light); }
.edge-chat.chat-set .chat-set__form .chat-set__title { margin-bottom: -14px; }
.chat-set__field { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.chat-set__field > label, .chat-set__field > legend { display: flex; align-items: baseline; gap: 8px; padding: 0; color: var(--edge-text-primary); font-size: 13px; line-height: 20px; font-weight: 600; }
.chat-set__field > label small, .chat-set__field > legend small { color: var(--edge-text-muted); font-size: 12px; font-weight: 400; }
.chat-set__field > legend { margin-bottom: 6px; }
.chat-set__field input[type=text], .chat-set__field textarea { box-sizing: border-box; width: 100%; min-width: 0; padding: 8px 12px; border: 1px solid var(--edge-border); border-radius: 6px; background: var(--edge-surface); color: var(--edge-text-primary); font-family: inherit; font-size: 14px; line-height: 20px; transition: border-color var(--edge-transition-fast), box-shadow var(--edge-transition-fast); }
.chat-set__field input[type=text] { height: 38px; }
.chat-set__field textarea { resize: vertical; line-height: 22px; }
.chat-set__field input[type=text]:hover, .chat-set__field textarea:hover { border-color: var(--edge-text-muted); }
.chat-set__field input[type=text]:focus, .chat-set__field textarea:focus { border-color: var(--edge-primary); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--edge-primary) 18%, transparent); }
.chat-set__rules { margin-top: 2px; color: var(--edge-text-muted); font-size: 12px; line-height: 18px; }
.chat-set__rules summary { display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; list-style: none; cursor: pointer; }
.chat-set__rules summary::-webkit-details-marker { display: none; }
.chat-set__rules summary:hover { color: var(--edge-text-secondary); }
.chat-set__rules summary i { font-size: 9px; transition: transform var(--edge-transition-fast); }
.chat-set__rules[open] summary i { transform: rotate(90deg); }
.chat-set__rules pre { margin: 8px 0 0; padding: 12px 14px; border-radius: 8px; background: var(--edge-surface-hover); color: var(--edge-text-secondary); font-family: inherit; font-size: 13px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-set__choices { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.chat-set__choices > legend { grid-column: 1 / -1; }
.edge-modern .chat-set .chat-set__choice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--edge-border); border-radius: 8px; cursor: pointer; transition: border-color var(--edge-transition-fast), background-color var(--edge-transition-fast); }
.edge-modern .chat-set .chat-set__choice:hover { background: var(--edge-surface-hover); }
.edge-modern .chat-set .chat-set__choice:has(input:checked) { border-color: var(--edge-primary); background: color-mix(in srgb, var(--edge-primary) 6%, transparent); }
.edge-modern .chat-set .chat-set__choice:has(input:focus-visible) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--edge-primary) 18%, transparent); }
.edge-modern .chat-set .chat-set__choice input { margin: 4px 0 0; accent-color: var(--edge-primary); }
.chat-set__choice span { display: grid; gap: 2px; }
.chat-set__choice strong { font-size: 14px; line-height: 20px; font-weight: 600; }
.chat-set__choice small { color: var(--edge-text-muted); font-size: 12px; line-height: 18px; }
.chat-set__tools { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; }
.chat-set__tools > legend { grid-column: 1 / -1; }
.edge-modern .chat-set .chat-set__tool { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--edge-border-light); border-radius: 6px; font-size: 13px; line-height: 20px; cursor: pointer; transition: border-color var(--edge-transition-fast), background-color var(--edge-transition-fast); }
.edge-modern .chat-set .chat-set__tool:hover { background: var(--edge-surface-hover); }
.edge-modern .chat-set .chat-set__tool:has(input:checked) { border-color: color-mix(in srgb, var(--edge-primary) 50%, transparent); background: color-mix(in srgb, var(--edge-primary) 6%, transparent); }
.edge-modern .chat-set .chat-set__tool input { margin: 0; accent-color: var(--edge-primary); }
.chat-set__actions { display: flex; align-items: center; gap: 8px; }
.chat-set__callout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 16px 18px; border-radius: 10px; background: var(--edge-surface-hover); }
.chat-set__callout > div { flex: 1 1 320px; min-width: 0; }
.chat-set__callout .chat-set__title { margin-bottom: 2px; }
.chat-set__callout .edge-button { flex: none; }
.chat-set__once { display: grid; gap: 10px; margin: -16px 0 32px; padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--edge-success) 40%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--edge-success) 8%, transparent); }
.chat-set__once code { display: block; padding: 10px 12px; border-radius: 6px; background: var(--edge-surface); font-size: 13px; line-height: 20px; overflow-wrap: anywhere; user-select: all; }
.chat-set__once div { display: flex; flex-wrap: wrap; gap: 8px; }
.edge-chat.chat-set button:active:not(:disabled) { transform: none; }
.edge-chat.chat-set .edge-button { font-weight: 600; }
@media (max-width: 760px) {
  .chat-persona-grid { grid-template-columns: minmax(0,1fr); }
  .chat-set__choices { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 600px) {
  .chat-set__nav { gap: 8px; }
  .chat-set__tabs { order: 2; width: 100%; margin-left: 0; overflow-x: auto; }
  .chat-set__tabs a { flex: none; }
  .edge-chat.chat-set h1 { font-size: 22px; line-height: 30px; }
  .chat-persona-card { padding: 12px 8px; margin: 0 -8px; }
  .chat-set__item { gap: 10px; }
  .chat-set__compose--inline { flex-wrap: wrap; padding: 4px; }
  .chat-set__compose--inline input { flex-basis: 100%; }
  .chat-set__compose--inline .edge-button { margin-left: auto; }
}
@media (max-width: 600px) {
  .chat-app .chat-foot .chat-disclaimer { display: none; }
  .chat-app .chat-suggest { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 18px; }
  .chat-app .chat-suggest__item { gap: 8px; padding: 10px 12px; }
  .chat-app .chat-suggest__item > i { margin-top: 2px; }
  .chat-app .chat-suggest__item strong, .chat-app .chat-suggest__item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-app .chat-welcome h2 { font-size: 20px; line-height: 28px; }
}

/* 角色广场：搜索 + 分类 + 无边框卡片 + 详情面板；编辑页左表单右预览。 */
.chat-plaza__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; }
.chat-plaza__head > div { min-width: 0; }
.edge-chat.chat-set .chat-plaza__create { display: inline-flex; flex: none; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; font-size: 14px; }
.chat-plaza__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.chat-plaza__search { position: relative; display: block; flex: 1 1 260px; max-width: 420px; }
.chat-plaza__search > i { position: absolute; top: 50%; left: 12px; color: var(--edge-text-muted); font-size: 12px; transform: translateY(-50%); pointer-events: none; }
.edge-modern .chat-plaza__search input { box-sizing: border-box; width: 100%; height: 36px; min-height: 0; margin: 0; padding: 0 12px 0 34px; border: 1px solid var(--edge-border); border-radius: 8px; background: var(--edge-surface); box-shadow: none; color: var(--edge-text-primary); font: inherit; font-size: 14px; -webkit-appearance: none; appearance: none; transition: border-color var(--edge-transition-fast), box-shadow var(--edge-transition-fast); }
.edge-modern .chat-plaza__search input:hover { border-color: var(--edge-text-muted); }
.edge-modern .chat-plaza__search input:focus { border-color: var(--edge-primary); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--edge-primary) 18%, transparent); }
.chat-plaza__sort { display: inline-flex; gap: 2px; margin-left: auto; padding: 2px; border-radius: 8px; background: var(--edge-surface-hover); }
.chat-plaza__sort button, .chat-plaza__chips button { border: 0; background: transparent; color: var(--edge-text-secondary); font: inherit; font-size: 13px; line-height: 20px; cursor: pointer; transition: background-color var(--edge-transition-fast), color var(--edge-transition-fast); }
.chat-plaza__sort button { padding: 4px 12px; border-radius: 6px; }
.chat-plaza__sort button[aria-checked="true"] { background: var(--edge-surface); color: var(--edge-text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.chat-plaza__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chat-plaza__chips button { padding: 4px 12px; border: 1px solid var(--edge-border-light); border-radius: 999px; }
.chat-plaza__chips button:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-plaza__chips button[aria-checked="true"] { border-color: var(--edge-text-primary); background: var(--edge-text-primary); color: var(--edge-bg); }
.chat-plaza__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
/* 卡片网格是 div，“我的角色”会被 :first-of-type 当成首个分区去掉上间距，这里补回。 */
.chat-plaza__grid ~ .chat-set__section { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--edge-border-light); }
.chat-pcard { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px; border-radius: 12px; background: var(--edge-surface-hover); transition: background-color var(--edge-transition-fast); }
.chat-pcard[hidden] { display: none; }
.chat-pcard:not(.is-preview):hover { background: var(--edge-surface-active); }
.chat-pcard__open { position: absolute; inset: 0; z-index: 1; width: 100%; padding: 0; border: 0; border-radius: inherit; background: transparent; cursor: pointer; }
.chat-pcard__open:focus-visible { outline: 2px solid var(--edge-primary); outline-offset: 2px; }
.chat-pcard__head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-pcard__head .chat-persona-card__icon { flex: none; }
.chat-pcard__title { display: grid; min-width: 0; }
.chat-pcard__title strong { display: flex; align-items: center; gap: 6px; overflow: hidden; color: var(--edge-text-primary); font-size: 15px; font-weight: 600; line-height: 22px; white-space: nowrap; text-overflow: ellipsis; }
.chat-pcard__title em { flex: none; padding: 0 6px; border-radius: 4px; background: var(--edge-primary-low); color: var(--edge-primary); font-size: 11px; font-style: normal; font-weight: 600; line-height: 18px; }
.chat-pcard__title small, .chat-pcard__foot { display: flex; flex-wrap: wrap; align-items: center; color: var(--edge-text-muted); font-size: 12px; line-height: 18px; font-variant-numeric: tabular-nums; }
.chat-pcard__title small span + span::before, .chat-pcard__foot > span + span::before { content: "·"; margin: 0 6px; }
.chat-set .chat-pcard__intro { display: -webkit-box; min-height: 40px; overflow: hidden; color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chat-pcard__caps { display: flex; flex-wrap: wrap; gap: 4px; }
.chat-pcard__caps span { padding: 1px 8px; border-radius: 4px; background: var(--edge-surface); color: var(--edge-text-secondary); font-size: 12px; line-height: 18px; }
.chat-pcard__caps .is-plain { background: transparent; color: var(--edge-text-muted); padding-left: 0; }
.chat-pcard__foot { margin-top: auto; }
.chat-pcard__open-tag i { margin-right: 4px; font-size: 10px; }
.chat-pcard__go { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 3px 10px; border-radius: 6px; color: var(--edge-text-primary); font-size: 13px; font-weight: 600; line-height: 20px; text-decoration: none; transition: background-color var(--edge-transition-fast); }
.chat-pcard__go i { font-size: 11px; transition: transform var(--edge-transition-fast); }
.chat-pcard__go:hover { background: var(--edge-surface); color: var(--edge-text-primary); text-decoration: none; }
.chat-pcard__go:hover i { transform: translateX(2px); }
.chat-pcard__foot > .chat-pcard__go::before { content: none; }
.chat-plaza__none { margin-top: 8px; }
.chat-set .chat-plaza__reason { margin-top: 2px; color: var(--edge-danger); font-size: 12px; line-height: 18px; }
.chat-set__pill--disabled { background: var(--edge-danger-low); color: var(--edge-danger); }

.chat-plaza__dialog { box-sizing: border-box; width: min(560px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 64px)); margin: auto; padding: 0; overflow: auto; border: 1px solid var(--edge-border); border-radius: 14px; background: var(--edge-surface-raised); color: var(--edge-text-primary); box-shadow: var(--edge-shadow-dialog); overscroll-behavior: contain; }
.chat-plaza__dialog::backdrop { background: rgba(0,0,0,.45); }
.chat-plaza__dialog[open] { animation: chat-plaza-in 200ms var(--edge-ease-out); }
.chat-plaza__dialog[open]::backdrop { animation: chat-plaza-fade 200ms ease; }
.chat-plaza__dialog.is-closing { animation: chat-plaza-out 160ms ease forwards; }
.chat-plaza__dialog.is-closing::backdrop { animation: chat-plaza-fade 160ms ease reverse forwards; }
@keyframes chat-plaza-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes chat-plaza-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes chat-plaza-fade { from { opacity: 0; } }
.chat-plaza__dialog-body { display: grid; gap: 12px; padding: 20px 22px 18px; }
.chat-plaza__d-head { display: flex; align-items: center; gap: 12px; }
.chat-plaza__d-title { flex: 1; min-width: 0; }
.chat-set .chat-plaza__d-title h2 { margin: 0; font-size: 18px; line-height: 26px; font-weight: 600; }
.chat-plaza__d-title small { color: var(--edge-text-muted); font-size: 12px; line-height: 18px; }
.chat-plaza__d-close { display: inline-flex; align-self: flex-start; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--edge-text-muted); cursor: pointer; }
.chat-plaza__d-close:hover { background: var(--edge-surface-hover); color: var(--edge-text-primary); }
.chat-set .chat-plaza__d-intro { color: var(--edge-text-secondary); font-size: 14px; line-height: 22px; }
.chat-set .chat-plaza__d-fork, .chat-set .chat-plaza__d-stats { color: var(--edge-text-muted); font-size: 12px; line-height: 18px; }
.chat-set .chat-plaza__d-label { margin: 6px 0 -4px; color: var(--edge-text-muted); font-size: 12px; font-weight: 600; line-height: 18px; }
.chat-plaza__d-starters { display: grid; gap: 4px; }
.chat-plaza__d-starters a { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--edge-surface-hover); color: var(--edge-text-primary); font-size: 13px; line-height: 20px; text-decoration: none; transition: background-color var(--edge-transition-fast); }
.chat-plaza__d-starters a i { margin-top: 3px; color: var(--edge-text-muted); font-size: 12px; }
.chat-plaza__d-starters a:hover { background: var(--edge-surface-active); color: var(--edge-text-primary); text-decoration: none; }
.chat-plaza__d-prompt summary { display: inline-flex; align-items: center; gap: 6px; color: var(--edge-text-secondary); font-size: 13px; list-style: none; cursor: pointer; }
.chat-plaza__d-prompt summary::-webkit-details-marker { display: none; }
.chat-plaza__d-prompt summary i { font-size: 9px; transition: transform var(--edge-transition-fast); }
.chat-plaza__d-prompt[open] summary i { transform: rotate(90deg); }
.chat-plaza__d-prompt pre { max-height: 260px; margin: 8px 0 0; padding: 12px 14px; overflow: auto; border-radius: 8px; background: var(--edge-surface-hover); color: var(--edge-text-secondary); font-family: inherit; font-size: 13px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-plaza__d-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.edge-chat.chat-set .chat-plaza__d-foot .edge-button { min-height: 36px; padding: 0 16px; font-size: 14px; }

.chat-plaza__back { margin-bottom: 8px; }
.chat-set .chat-plaza__notice { display: flex; align-items: center; gap: 8px; margin: -8px 0 20px; padding: 10px 14px; border-radius: 8px; font-size: 13px; line-height: 20px; }
.chat-plaza__notice.is-wait { background: var(--edge-warning-low); color: var(--edge-warning); }
.chat-plaza__notice.is-off { background: var(--edge-danger-low); color: var(--edge-danger); }
.chat-plaza__notice.is-ok { background: color-mix(in srgb, var(--edge-success) 12%, transparent); color: var(--edge-success); }
.chat-plaza__editor { display: grid; grid-template-columns: minmax(0,1fr) 300px; align-items: start; gap: 32px; }
.chat-set .chat-plaza__form { padding-top: 0; border-top: 0; }
.chat-plaza__pair { display: grid; grid-template-columns: minmax(0,1fr) 180px; gap: 12px; }
.edge-modern .chat-plaza__select { box-sizing: border-box; width: 100%; height: 38px; min-height: 0; margin: 0; padding: 0 10px; border: 1px solid var(--edge-border); border-radius: 6px; background-color: var(--edge-surface); color: var(--edge-text-primary); font: inherit; font-size: 14px; }
.chat-plaza__label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-plaza__label-row label { display: flex; align-items: baseline; gap: 8px; color: var(--edge-text-primary); font-size: 13px; font-weight: 600; line-height: 20px; }
.chat-plaza__label-row label small { color: var(--edge-text-muted); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.chat-plaza__ai { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: var(--edge-primary-low); color: var(--edge-primary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background-color var(--edge-transition-fast); }
.chat-plaza__ai:hover:not(:disabled) { background: color-mix(in srgb, var(--edge-primary) 20%, transparent); }
.chat-plaza__ai:disabled { cursor: progress; }
.chat-plaza__ai-mark .edge-ai-mark { width: 14px; height: 14px; }
.chat-plaza__ai.is-busy .edge-ai-mark { animation: chat-mark 1.6s ease-in-out infinite; }
.chat-plaza__starters { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.chat-plaza__starters > legend { grid-column: 1 / -1; }
.edge-modern .chat-set .chat-plaza__starters input[type=text] { height: 36px; font-size: 13px; }
.edge-modern .chat-set .chat-plaza__share { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--edge-surface-hover); cursor: pointer; }
.edge-modern .chat-set .chat-plaza__share input { margin: 3px 0 0; accent-color: var(--edge-primary); }
.chat-plaza__share span { display: grid; gap: 2px; }
.chat-plaza__share strong { font-size: 14px; line-height: 20px; }
.chat-plaza__share small { color: var(--edge-text-muted); font-size: 12px; line-height: 18px; }
.chat-plaza__actions { flex-wrap: wrap; }
.chat-plaza__preview { position: sticky; top: calc(var(--edge-header-height) + 24px); display: grid; gap: 10px; }
.chat-set .chat-plaza__preview-label { color: var(--edge-text-muted); font-size: 12px; font-weight: 600; line-height: 18px; }
.chat-plaza__preview-starters { display: grid; gap: 4px; }
.chat-plaza__preview-starters span { padding: 6px 10px; border-radius: 8px; background: var(--edge-surface-hover); color: var(--edge-text-secondary); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
.chat-plaza__submit { display: grid; gap: 10px; margin-top: 32px; padding: 16px 18px; border-radius: 10px; background: var(--edge-surface-hover); }
.edge-modern .chat-set .chat-plaza__submit textarea { box-sizing: border-box; width: 100%; padding: 8px 12px; border: 1px solid var(--edge-border); border-radius: 6px; background: var(--edge-surface); color: var(--edge-text-primary); font: inherit; font-size: 13px; line-height: 20px; resize: vertical; }
.chat-plaza__submit .edge-button { justify-self: start; min-height: 34px; padding: 0 14px; font-size: 14px; }
@media (max-width: 900px) {
  .chat-plaza__editor { grid-template-columns: minmax(0,1fr); }
  .chat-plaza__preview { position: static; order: -1; }
  .chat-plaza__preview-starters { display: none; }
}
@media (max-width: 600px) {
  .chat-plaza__head { flex-direction: column; }
  .chat-plaza__sort { margin-left: 0; }
  .chat-plaza__search { max-width: none; }
  .chat-plaza__pair, .chat-plaza__starters { grid-template-columns: minmax(0,1fr); }
  .chat-plaza__dialog-body { padding: 18px 16px 16px; }
}
@media (prefers-reduced-motion: reduce) { .chat-plaza__dialog[open], .chat-plaza__dialog.is-closing { animation: none; } }
.chat-admin .chat-admin__note { margin-top: 6px; padding: 8px 10px; border-radius: 6px; background: var(--edge-surface-hover); color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; }
.chat-admin__note b { margin-right: 8px; color: var(--edge-text-primary); font-weight: 600; }
.chat-admin .chat-admin__starters { margin: 8px 0 0; padding-left: 18px; color: var(--edge-text-secondary); font-size: 13px; line-height: 20px; }
.chat-admin__reject { display: grid; gap: 6px; width: 100%; }
.chat-admin__reject[hidden] { display: none; }
.edge-modern .chat-admin__reject textarea { box-sizing: border-box; width: 100%; min-width: 220px; padding: 6px 10px; border: 1px solid var(--edge-border); border-radius: 6px; background: var(--edge-surface); color: var(--edge-text-primary); font: inherit; font-size: 13px; line-height: 20px; resize: vertical; }
.chat-plaza__dialog-body:focus { outline: 0; }
.chat-pcard__foot > span:empty, .chat-pcard__title small span:empty { display: none; }
