:root {
  color-scheme: light;
  --page: #f5f7fb;
  --page-2: #edf4f7;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-2: rgba(246, 249, 252, 0.9);
  --ink: #111827;
  --muted: #667085;
  --line: rgba(148, 163, 184, 0.28);
  --line-2: rgba(100, 116, 139, 0.35);
  --teal: #007aff;
  --teal-soft: #eaf4ff;
  --clay: #0f766e;
  --clay-soft: #e7f8f4;
  --blue: #007aff;
  --danger: #c24136;
  --shadow: 0 28px 80px rgba(15, 23, 42, 0.12);
  --radius: 18px;
  --card-radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.94), transparent 22rem),
    radial-gradient(circle at 86% 18%, rgba(218, 246, 239, 0.66), transparent 18rem),
    linear-gradient(135deg, var(--page), var(--page-2));
  color: var(--ink);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  letter-spacing: 0;
}

@keyframes enterSoft {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 1px solid transparent;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  outline: none;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.13);
}

.hidden {
  display: none !important;
}

.primary,
.send-button {
  border-color: var(--teal);
  background: linear-gradient(180deg, #1688ff, #0068d9);
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
}

.primary:hover,
.send-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(0, 122, 255, 0.24);
}

.ghost,
.icon-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 13px;
}

.ghost:hover,
.icon-button:hover {
  border-color: var(--teal);
  background: white;
  transform: translateY(-1px);
}

.danger {
  color: var(--danger);
}

.wide {
  width: 100%;
}

.link-button {
  text-decoration: none;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, calc(100vw - 32px));
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 30px;
  backdrop-filter: blur(16px);
  animation: enterSoft 0.42s ease both;
}

.mark,
.empty-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: #fff8e8;
  border: 1px solid rgba(225, 210, 180, 0.9);
  box-shadow: 0 14px 34px rgba(31, 111, 235, 0.16);
  overflow: hidden;
}

.mark img,
.empty-mark img,
.brand-mark {
  display: block;
  width: 100%;
  height: 100%;
}

.auth-card h1 {
  margin: 18px 0 4px;
  font-size: 28px;
}

.auth-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.auth-card label,
.editor-grid label,
.textarea-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.auth-card label {
  margin-bottom: 14px;
}

.error {
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
}

.sidebar,
.chat-shell,
.admin-sidebar,
.admin-main {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(45, 38, 30, 0.08);
  backdrop-filter: blur(18px);
  animation: enterSoft 0.4s ease both;
}

.sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
}

.brand-lockup {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-lockup strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(31, 111, 235, 0.14);
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.prompt-panel {
  padding: 0 12px 12px;
  overflow: auto;
  max-height: 48vh;
}

.history-panel {
  flex: 1;
  min-height: 0;
  padding: 0 12px 14px;
  overflow: auto;
}

.section-title,
.history-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: 10px 8px;
}

.category-card {
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  margin-bottom: 8px;
  overflow: hidden;
}

.category-card[open] {
  border-color: rgba(222, 216, 206, 0.82);
  background: rgba(255, 255, 255, 0.68);
}

.category-card summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 13px;
  cursor: pointer;
  font-weight: 800;
}

.category-card summary::-webkit-details-marker {
  display: none;
}

.category-card em {
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 12px;
  font-style: normal;
  text-align: center;
}

.prompt-stack {
  display: grid;
  gap: 8px;
  padding: 0 8px 10px;
}

.prompt-card {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 11px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.prompt-card:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.prompt-title {
  font-weight: 800;
}

.prompt-title b {
  color: var(--clay);
  margin-right: 4px;
}

.prompt-card small,
.prompt-card i {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.history-list {
  display: grid;
  gap: 6px;
}

.history-group {
  display: grid;
  gap: 6px;
  animation: enterSoft 0.22s ease both;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 14px;
  transform: translateZ(0);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.history-row:hover,
.history-row.active {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  transform: translateX(2px);
}

.history-open {
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 9px 10px 12px;
}

.history-open span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.history-open small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  margin-top: 4px;
}

.history-open b {
  color: var(--clay);
  font-weight: 800;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 5px;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.history-row:hover .history-actions,
.history-row.active .history-actions {
  opacity: 1;
  transform: translateX(0);
}

.history-actions button {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.history-actions button:hover {
  background: var(--clay-soft);
  color: var(--danger);
  transform: scale(1.06);
}

.empty-history {
  margin: 8px;
  color: var(--muted);
  font-size: 13px;
}

.archive-section {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.archive-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.archive-title::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--clay);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
}

.archive-folder {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  overflow: hidden;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.archive-folder[open] {
  border-color: rgba(15, 118, 110, 0.2);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
}

.archive-folder summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  font-weight: 850;
}

.archive-folder summary::-webkit-details-marker {
  display: none;
}

.archive-folder summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-folder summary::before {
  content: "▸";
  color: var(--clay);
  transition: transform 0.18s ease;
}

.archive-folder[open] summary::before {
  transform: rotate(90deg);
}

.archive-folder summary em {
  min-width: 26px;
  border-radius: 999px;
  background: var(--clay-soft);
  color: var(--clay);
  font-size: 12px;
  font-style: normal;
  text-align: center;
  padding: 2px 8px;
}

.archive-folder-body {
  display: grid;
  gap: 4px;
  padding: 0 6px 8px 14px;
  animation: archiveUnfold 0.18s ease both;
}

@keyframes archiveUnfold {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-shell {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.chat-header,
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(222, 216, 206, 0.72);
}

.title-block {
  min-width: 0;
}

.title-input {
  width: min(560px, 50vw);
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: 0;
  font-size: 19px;
  font-weight: 850;
}

.title-input:focus {
  box-shadow: none;
}

.meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-actions select {
  min-width: 210px;
}

.messages {
  min-height: 0;
  overflow: auto;
  padding: 28px max(28px, 9vw);
}

.empty-state {
  min-height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
}

.empty-state .empty-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
}

.empty-state h2 {
  margin: 8px 0 0;
  color: var(--ink);
}

.empty-state p {
  margin: 0;
}

.message {
  max-width: 920px;
  margin: 0 auto 18px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
}

.message.notice {
  grid-template-columns: minmax(0, 1fr);
}

.notice-card {
  width: fit-content;
  max-width: min(680px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, auto) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(0, 122, 255, 0.12);
  border-radius: 999px;
  background: rgba(244, 248, 255, 0.86);
  color: #1f2937;
  padding: 8px 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.notice-card span,
.notice-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.notice-card strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 13px;
  font-weight: 850;
}

.message.user .avatar {
  background: var(--clay-soft);
  color: var(--clay);
}

.bubble {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  padding: 15px 17px;
  line-height: 1.72;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.055);
}

.message.user .bubble {
  background: rgba(232, 244, 255, 0.8);
  border-color: rgba(0, 122, 255, 0.18);
}

.message.notice .bubble {
  max-width: 920px;
  margin: 0 auto;
  background: var(--teal-soft);
  color: #174c9a;
  border-color: #c8dcff;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  color: var(--muted);
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  opacity: 0.35;
  animation: typingPulse 1.15s ease-in-out infinite;
}

.typing span:nth-child(2) {
  animation-delay: 0.16s;
}

.typing span:nth-child(3) {
  animation-delay: 0.32s;
}

.typing em {
  font-style: normal;
  font-size: 13px;
  margin-left: 2px;
}


@keyframes typingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.28;
  }

  40% {
    transform: translateY(-4px);
    opacity: 0.95;
  }
}

@keyframes thinkingSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes thinkingDot {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.72);
    opacity: 0.42;
  }

  50% {
    transform: translate(-50%, -50%) scale(1.18);
    opacity: 1;
  }
}

@keyframes thinkingBar {
  0% {
    transform: translateX(-105%);
  }

  100% {
    transform: translateX(245%);
  }
}

.bubble table {
  width: 100%;
  border-collapse: collapse;
}

.bubble th,
.bubble td {
  border: 1px solid var(--line);
  padding: 7px 9px;
}

.bubble pre {
  overflow: auto;
  border-radius: 12px;
  background: #171b1e;
  color: #f8fafc;
  padding: 13px;
}

.composer {
  padding: 14px max(20px, 9vw) 18px;
  border-top: 1px solid rgba(222, 216, 206, 0.72);
}

.input-wrap {
  max-width: 920px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.1);
  padding: 11px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.input-wrap:focus-within {
  border-color: rgba(0, 122, 255, 0.62);
  box-shadow: 0 22px 58px rgba(0, 122, 255, 0.14);
  transform: translateY(-1px);
}

.input-wrap textarea,
.input-wrap .composer-input {
  min-height: 58px;
  max-height: 180px;
  border: 0;
  background: transparent;
  resize: none;
  box-shadow: none;
}

.input-wrap textarea:focus,
.input-wrap .composer-input:focus {
  box-shadow: none;
}

/* contenteditable 输入区:可承载内联图片胶囊,行为对齐 textarea */
.input-wrap .composer-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  cursor: text;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
}

.input-wrap .composer-input.is-empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.attachments {
  max-width: 920px;
  margin: 0 auto 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  padding: 5px 10px;
  font-size: 12px;
}

.attachment.with-preview {
  max-width: 220px;
  min-height: 52px;
  border-radius: 8px;
  padding: 4px 8px 4px 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.attachment.with-preview img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex: 0 0 auto;
}

.attachment.with-preview span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.thinking-toggle,
.user-chip {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 7px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.thinking-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.thinking-toggle:has(input:checked) {
  color: var(--teal);
  border-color: rgba(0, 122, 255, 0.34);
  background: var(--teal-soft);
}

.user-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(145deg, #111827, #334155);
  color: white;
  font-size: 12px;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reasoning {
  margin-bottom: 12px;
  border: 1px solid rgba(0, 122, 255, 0.16);
  border-radius: 14px;
  background: rgba(234, 244, 255, 0.65);
  padding: 10px 12px;
  color: #31527a;
}

.reasoning summary {
  cursor: pointer;
  font-weight: 850;
}

.reasoning div {
  margin-top: 8px;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.65;
}

.admin-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
}

.admin-sidebar {
  overflow: hidden;
}

.admin-nav {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.admin-nav button {
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 12px;
  font-weight: 800;
}

.admin-nav button.active,
.admin-nav button:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.admin-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.admin-header h1 {
  margin: 0;
  font-size: 24px;
}

.admin-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.admin-content {
  overflow: auto;
  padding: 20px;
}

.metric-grid,
.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.metric-card,
.admin-section {
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: rgba(255, 253, 248, 0.86);
  padding: 16px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.admin-section {
  margin-top: 14px;
}

.admin-section h2 {
  margin: 0 0 14px;
  font-size: 17px;
}

.table-wrap {
  overflow: auto;
}


.credit-plus {
  color: #047857;
  font-weight: 700;
}

.credit-minus {
  color: #b91c1c;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.admin-two-col,
.prompt-admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
}

.section-row,
.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drag-list {
  display: grid;
  gap: 9px;
}

.drag-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: white;
  padding: 9px;
}

.drag-item.dragging {
  opacity: 0.55;
}

.drag-handle {
  color: var(--muted);
  cursor: grab;
  text-align: center;
  font-weight: 900;
}

.switch,
.check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.switch input,
.check-line input {
  width: auto;
}

.soft-note {
  background: var(--teal-soft);
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.category-pills button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 8px 12px;
}

.category-pills button.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
}

.prompt-drag-list .drag-item {
  grid-template-columns: 32px minmax(0, 1fr);
}

.prompt-list-item.active {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.prompt-list-item button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
}

.prompt-list-item strong,
.prompt-list-item small {
  display: block;
}

.prompt-list-item small {
  color: var(--muted);
  margin-top: 4px;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.editor-grid .setting-toggle {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.72);
  padding: 12px 14px;
  color: var(--ink);
}

.setting-toggle input {
  position: relative;
  width: 42px !important;
  height: 24px;
  appearance: none;
  border: 0 !important;
  border-radius: 999px !important;
  background: #cbd5e1 !important;
  cursor: pointer;
  transition: background 0.18s ease;
}

.setting-toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
  transition: transform 0.18s ease;
}

.setting-toggle input:checked {
  background: var(--teal) !important;
}

.setting-toggle input:checked::after {
  transform: translateX(18px);
}

.setting-toggle span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.setting-toggle strong {
  font-size: 13px;
  color: var(--ink);
}

.setting-toggle em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
  line-height: 1.45;
}

.textarea-label {
  margin-top: 12px;
}

.textarea-label textarea {
  min-height: 360px;
  font-family: "Cascadia Code", Consolas, monospace;
  line-height: 1.6;
}

.editor-actions {
  margin-top: 12px;
}

.model-card {
  margin-top: 0;
}

.compact-model-grid {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.model-provider {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.model-manage-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.model-desc-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.model-desc-label input {
  width: 100%;
  font-size: 13px;
}

.pricing-panel {
  max-width: 1180px;
}

.pricing-list {
  display: grid;
  gap: 12px;
}

.pricing-row {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(420px, 1.35fr) minmax(150px, 0.55fr) auto;
  align-items: start;
  gap: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  padding: 14px;
}

.pricing-row.disabled {
  opacity: 0.62;
}

.pricing-main strong,
.pricing-main span {
  display: block;
}

.pricing-main span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.pricing-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.pricing-fields label,
.pricing-tiers {
  color: var(--muted);
  font-size: 12px;
}

.pricing-fields input,
.pricing-tiers textarea {
  margin-top: 5px;
}

.pricing-tiers textarea {
  min-height: 92px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}

.pricing-tiers summary {
  cursor: pointer;
  color: #111827;
  font-weight: 700;
}

@media (max-width: 980px) {
  .app-shell,
  .admin-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .sidebar,
  .admin-sidebar {
    max-height: none;
  }

  .chat-shell,
  .admin-main {
    min-height: 72vh;
  }

  .admin-two-col,
  .prompt-admin-layout,
  .pricing-row {
    grid-template-columns: 1fr;
  }

  .pricing-fields,
  .model-manage-grid {
    grid-template-columns: 1fr;
  }

  .message {
    grid-template-columns: 1fr;
  }

  .avatar {
    display: none;
  }

  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Refined admin workspace */
.admin-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(246, 248, 251, 0.92)),
    radial-gradient(circle at 50% 0%, rgba(0, 122, 255, 0.08), transparent 32rem);
}

.admin-sidebar,
.admin-main {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.admin-sidebar {
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  backdrop-filter: blur(24px);
}

.admin-nav {
  gap: 4px;
  padding: 8px 12px;
}

.admin-nav button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  padding: 10px 12px;
  transition: background 0.16s ease, transform 0.16s ease, color 0.16s ease;
}

.admin-nav button.active,
.admin-nav button:hover {
  border-color: transparent;
  background: color-mix(in srgb, var(--surface) 92%, var(--teal-soft));
  color: var(--ink);
  transform: translateX(2px);
}

.admin-nav button.active {
  box-shadow: inset 2px 0 0 var(--teal);
}

.admin-main {
  grid-template-rows: auto minmax(0, 1fr);
}

.admin-header {
  min-height: 76px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(18px);
}

.admin-header h1 {
  font-size: 22px;
  font-weight: 760;
  color: var(--ink);
}

.admin-header p {
  color: var(--muted);
}

.admin-content {
  padding: 22px max(22px, 4vw);
}

.metric-grid,
.model-grid {
  gap: 12px;
}

.metric-card,
.admin-section {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm, 0 16px 44px rgba(15, 23, 42, 0.07));
  backdrop-filter: blur(18px);
  padding: 16px;
}

.metric-card strong {
  font-size: 28px;
  font-weight: 780;
}

.admin-section h2 {
  font-size: 16px;
  font-weight: 760;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}

/* ---------- 侧栏导航分组(运营 / 内容 / 配置) ---------- */
.admin-nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-nav-group + .admin-nav-group {
  margin-top: 14px;
}

.admin-nav-label {
  padding: 2px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* ---------- 统计页:可折叠明细表 ---------- */
.stats-fold {
  padding: 0;
  overflow: hidden;
}

.stats-fold > .table-wrap {
  margin: 0 16px 16px;
  border-radius: 12px;
}

.stats-fold-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.stats-fold-head::-webkit-details-marker {
  display: none;
}

.stats-fold-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.stats-fold-title h2 {
  margin: 0;
}

.stats-fold-caret {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-size: 14px;
  transition: transform 0.18s ease;
}

.stats-fold[open] .stats-fold-caret {
  transform: rotate(180deg);
}

.stats-fold-head:hover {
  background: color-mix(in srgb, var(--surface) 60%, var(--teal-soft));
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  padding: 12px 14px;
}

th {
  background: rgba(248, 250, 252, 0.88);
  font-weight: 740;
}

tr:last-child td {
  border-bottom: 0;
}

.drag-item {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.drag-item:hover {
  border-color: rgba(0, 122, 255, 0.24);
  transform: translateY(-1px);
}

.category-pills button {
  border: 0;
  background: rgba(241, 245, 249, 0.9);
  color: #475467;
}

.category-pills button.active {
  border-color: transparent;
  background: #111827;
  color: #fff;
}

.prompt-list-item.active {
  border-color: rgba(0, 122, 255, 0.24);
  background: rgba(234, 244, 255, 0.74);
}

.editor-grid label,
.textarea-label {
  color: #667085;
  font-weight: 650;
}

.editor-grid input,
.editor-grid select,
.textarea-label textarea,
.drag-item input {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.86);
}

.textarea-label textarea {
  min-height: 420px;
}

.soft-note {
  background: rgba(234, 244, 255, 0.72);
}

.section-row .primary,
.editor-actions .primary,
.drag-item button,
.admin-header .ghost {
  min-height: 36px;
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

/* Refined chat workspace */
body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(246, 248, 251, 0.92)),
    radial-gradient(circle at 50% 0%, rgba(0, 122, 255, 0.08), transparent 32rem);
}

.app-shell {
  gap: 0;
  padding: 0;
  grid-template-columns: 300px minmax(0, 1fr);
}

.sidebar,
.chat-shell {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(247, 248, 250, 0.88);
  backdrop-filter: blur(24px);
}

.sidebar-top {
  padding: 18px 16px 12px;
}

.brand-lockup {
  grid-template-columns: 34px minmax(0, 1fr);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
}

.brand-lockup strong,
.title-input {
  font-weight: 760;
}

.prompt-panel {
  max-height: 44vh;
}

.section-title,
.history-label {
  margin: 14px 10px 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.category-card,
.category-card[open] {
  border: 0;
  border-radius: 12px;
  background: transparent;
}

.category-card summary {
  min-height: 42px;
  border-radius: 12px;
  padding: 10px 12px;
  color: #202124;
  transition: background 0.16s ease, transform 0.16s ease;
}

.category-card summary:hover {
  background: rgba(255, 255, 255, 0.86);
}

.category-card em {
  width: 24px;
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  color: #6b7280;
  transition: transform 0.18s ease;
}

.category-card[open] em {
  transform: rotate(180deg);
}

.prompt-stack {
  gap: 3px;
  padding: 2px 6px 8px 14px;
  animation: enterSoft 0.18s ease both;
}

.prompt-card {
  display: block;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 9px 10px;
  box-shadow: none;
}

.prompt-card i {
  display: none;
}

.prompt-card small {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
}

.prompt-card:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: transparent;
  box-shadow: none;
  transform: translateX(2px);
}

.prompt-title {
  font-size: 13px;
  font-weight: 650;
}

.chat-header {
  min-height: 66px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(18px);
  position: relative;
  z-index: 80;
}

.header-actions select {
  min-width: 190px;
  height: 38px;
  border-radius: 999px;
  background: rgba(246, 248, 251, 0.86);
}

.native-model-select {
  display: none;
}

.model-picker {
  position: relative;
}

.model-trigger {
  min-width: 230px;
  height: 40px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 999px;
  background: rgba(246, 248, 251, 0.92);
  color: #202124;
  padding: 5px 10px 5px 6px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.model-trigger span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-weight: 720;
}

.model-trigger i {
  color: var(--muted);
  font-style: normal;
}

.model-badge {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #111827;
  color: white;
  font-size: 11px;
  font-weight: 850;
}

.model-badge.image {
  background: transparent;
}

.model-badge img,
.model-icon {
  width: 30px;
  height: 30px;
  display: block;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
}


.model-menu {
  position: fixed;
  right: auto;
  top: auto;
  z-index: 1000;
  width: min(360px, calc(100vw - 32px));
  max-height: 420px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.16);
  padding: 8px;
  backdrop-filter: blur(18px);
  animation: enterSoft 0.16s ease both;
}

.model-menu button {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 9px;
  text-align: left;
}

.model-menu button:hover {
  background: #f3f5f7;
}

.model-menu strong,
.model-menu small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-menu strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 720;
}

.model-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-agent-tag,
.model-multimodal-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 5px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.045);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.model-multimodal-tag {
  border-color: rgba(20, 184, 166, 0.2);
  background: rgba(20, 184, 166, 0.07);
  color: #0f766e;
}

html[data-theme="aurora"] .model-multimodal-tag {
  border-color: rgba(94, 234, 212, 0.28);
  background: rgba(45, 212, 191, 0.12);
  color: #7dd3c7;
}

.model-menu small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.user-chip,
.icon-tool,
.send-button {
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.user-chip {
  border: 0;
  background: rgba(246, 248, 251, 0.9);
  color: #202124;
}

.user-chip:hover,
.icon-tool:hover,
.send-button:hover {
  transform: translateY(-1px);
}

.messages {
  padding: 34px max(24px, 12vw) 22px;
}

.message {
  max-width: 820px;
  grid-template-columns: 36px minmax(0, 1fr);
  margin-bottom: 22px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.bubble {
  border: 0;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
  padding: 6px 0;
}

.message.user .bubble {
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  padding: 12px 15px;
  border-radius: 18px;
  background: #f1f3f5;
  border: 0;
}

.composer {
  padding: 12px max(18px, 12vw) 24px;
  border-top: 0;
}

.input-wrap {
  max-width: 820px;
  position: relative;
  border-radius: 28px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
  padding: 10px;
}

.input-wrap textarea,
.input-wrap .composer-input {
  min-height: 54px;
  padding: 10px 12px 6px 34px;
  line-height: 1.55;
  resize: none;
  overflow: auto;
}

.composer.expanded .input-wrap {
  max-width: min(1040px, calc(100vw - 360px));
}

.composer.expanded .input-wrap textarea,
.composer.expanded .input-wrap .composer-input {
  min-height: 34vh;
  max-height: 46vh;
}

.expand-composer {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #7b8492;
  font-size: 14px;
}

.expand-composer:hover {
  background: #f1f3f5;
  color: #111827;
}

.composer-actions {
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.composer-left,
.composer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-tool,
.send-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 0;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.icon-tool {
  background: transparent;
  color: #3f4652;
}

.icon-tool:hover {
  background: #f1f3f5;
  box-shadow: none;
}

.send-button {
  background: #111827;
  color: white;
  font-weight: 800;
}

.send-button:hover {
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.22);
}

.thinking-toggle {
  min-height: 36px;
  gap: 0;
  border: 0;
  background: transparent;
  padding: 0;
}

.thinking-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.thinking-toggle span {
  width: 54px;
  height: 28px;
  display: block;
  position: relative;
  border-radius: 999px;
  background: #edf0f3;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
  transition: background 0.18s ease;
}

.thinking-toggle span::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.18);
  transition: transform 0.18s ease;
}

.thinking-toggle input:checked + span {
  background: #111827;
}

.thinking-toggle input:checked + span::before {
  transform: translateX(26px);
}

.attachments {
  max-width: 820px;
}

.attachment {
  background: rgba(241, 243, 245, 0.86);
  border: 0;
}

.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(6px);
}

.profile-panel {
  width: min(380px, calc(100vw - 24px));
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(255, 255, 255, 0.92);
  border-left: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: -28px 0 80px rgba(15, 23, 42, 0.18);
  padding: 18px;
  animation: profileSlide 0.22s ease both;
}

@keyframes profileSlide {
  from {
    transform: translateX(18px);
    opacity: 0;
  }
}

.profile-head {
  display: flex;
  justify-content: flex-end;
}

.profile-identity {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 18px 0 24px;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(145deg, #111827, #334155);
  color: white;
  font-size: 32px;
  font-weight: 800;
  cursor: pointer;
}

.profile-avatar img,
.profile-avatar span,
.profile-avatar span img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-identity strong {
  font-size: 22px;
}

.profile-name-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.profile-name-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-tool.compact {
  width: 30px;
  height: 30px;
  min-width: 30px;
}

.profile-uid {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.profile-identity > span,
.profile-grid span,
.profile-section p {
  color: var(--muted);
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.profile-grid div,
.profile-section {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.86);
  padding: 14px;
}

.profile-grid span,
.profile-grid strong {
  display: block;
}

.profile-grid strong {
  margin-top: 6px;
  font-size: 14px;
}

.profile-section {
  margin-top: 12px;
}

.profile-section h2 {
  margin: 0 0 12px;
  font-size: 14px;
}

.profile-action-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.profile-action-section h2 {
  margin-bottom: 5px;
}

.profile-action-section p {
  margin: 0;
  font-size: 12px;
}

.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-row input {
  width: 20px;
  height: 20px;
  accent-color: #111827;
}

.password-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.password-grid input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  outline: none;
}


.credit-history {
  display: grid;
  gap: 10px;
  max-height: min(520px, 68vh);
  overflow: auto;
}

.credit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.78);
  padding: 10px;
}

.credit-row:last-child {
  padding-bottom: 10px;
}

.credit-row-main {
  flex: 1;
  min-width: 0;
}

.credit-row-main strong,
.credit-row-main span,
.credit-row-main em {
  display: block;
}

.credit-row-main span {
  margin-top: 3px;
}

.credit-row-main em {
  margin-top: 5px;
  font-style: normal;
  color: #8a94a6;
  font-size: 11px;
}

.credit-row-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-weight: 800;
}

.credit-row-icon.credit {
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
}

.credit-row-icon.debit {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
}

.credit-row-main span,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.credit-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.2);
  padding: 18px;
}

.archive-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.2);
  padding: 18px;
  animation: enterSoft 0.18s ease both;
}

.credit-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.credit-dialog-head h2,
.credit-dialog-head p {
  margin: 0;
}

.credit-dialog-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.profile-actions {
  margin-top: 14px;
}

.profile-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.recharge-dialog {
  width: min(640px, calc(100vw - 32px));
}

.archive-folder-choices {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.archive-folder-choices button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 11px 12px;
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.archive-folder-choices button:hover {
  border-color: rgba(15, 118, 110, 0.36);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.archive-folder-choices span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.archive-new-folder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.archive-new-folder input {
  height: 42px;
  border-radius: 14px;
  background: #f8fafc;
}

.recharge-content {
  display: grid;
  gap: 14px;
}

.recharge-providers,
.recharge-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.recharge-provider,
.recharge-plan,
.payment-box,
.recharge-recent {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.recharge-provider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
}

.recharge-provider.disabled {
  opacity: 0.64;
}

.recharge-provider span,
.recharge-plan strong {
  font-weight: 800;
}

.recharge-provider em,
.recharge-plan em,
.recharge-order em {
  margin-left: auto;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.recharge-plan {
  min-height: 92px;
  padding: 12px;
  text-align: left;
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.recharge-plan span {
  color: #047857;
  font-weight: 800;
}

.payment-box,
.recharge-recent {
  padding: 12px;
}

.payment-box h3,
.recharge-recent h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.payment-placeholder {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
  text-align: center;
  word-break: break-all;
  padding: 14px;
}

.payment-placeholder code {
  white-space: pre-wrap;
}

.payment-placeholder.empty span {
  color: var(--muted);
  font-weight: 700;
}

.payment-box p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.recharge-order {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.recharge-order:first-of-type {
  border-top: 0;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(7px);
}

.name-dialog {
  width: min(360px, calc(100vw - 32px));
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
  padding: 18px;
  animation: enterSoft 0.18s ease both;
}

.name-dialog h2 {
  margin: 0 0 12px;
  font-size: 17px;
}

.name-dialog input {
  height: 44px;
  border-radius: 14px;
  background: #f8fafc;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .prompt-panel {
    max-height: none;
  }
}

/* 2026-05 design refresh: product-console language inspired by DESIGN.md systems. */
:root {
  color-scheme: dark;
  --page: #07080a;
  --page-2: #0a0b0d;
  --surface: #0d0f12;
  --surface-2: #12151a;
  --surface-3: #171b21;
  --surface-4: #1d222a;
  --ink: #f4f6f8;
  --muted: #9aa3af;
  --muted-2: #69717d;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --teal: #00d992;
  --teal-soft: rgba(0, 217, 146, 0.12);
  --clay: #8ad7ff;
  --clay-soft: rgba(138, 215, 255, 0.12);
  --blue: #8a8fff;
  --danger: #ff6b6b;
  --warning: #ffc857;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 12px;
  --card-radius: 8px;
}

html {
  background: var(--page);
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 180px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 96px),
    var(--page);
  color: var(--ink);
  font-feature-settings: "calt", "kern", "liga";
}

button,
input,
textarea,
select {
  letter-spacing: 0;
}

button {
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

input,
textarea,
select {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(0, 217, 146, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 217, 146, 0.12);
}

.primary,
.send-button {
  border-color: rgba(0, 217, 146, 0.72);
  border-radius: 8px;
  background: linear-gradient(180deg, #19e6a2, #00c884);
  color: #04110c;
  font-weight: 750;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.primary:hover,
.send-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0, 217, 146, 0.2);
}

.ghost,
.icon-button,
.icon-tool,
.expand-composer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
}

.ghost:hover,
.icon-button:hover,
.icon-tool:hover,
.expand-composer:hover {
  border-color: var(--line-2);
  background: var(--surface-3);
  color: var(--ink);
  transform: translateY(-1px);
}

.auth-shell {
  background:
    radial-gradient(circle at 50% -10%, rgba(0, 217, 146, 0.12), transparent 28rem),
    var(--page);
}

.auth-card,
.sidebar,
.chat-shell,
.admin-sidebar,
.admin-main,
.profile-panel,
.credit-dialog,
.archive-dialog,
.name-dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(13, 15, 18, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card {
  padding: 28px;
}

.auth-card h1 {
  color: var(--ink);
  font-size: 26px;
  font-weight: 650;
}

.auth-card p,
.meta,
.eyebrow,
.section-title,
.history-label,
.prompt-card small,
.prompt-card i {
  color: var(--muted);
}

.mark,
.empty-mark,
.brand-mark {
  border: 1px solid rgba(0, 217, 146, 0.26);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(0, 217, 146, 0.18), rgba(138, 215, 255, 0.08));
  box-shadow: none;
}

.app-shell,
.admin-shell {
  gap: 10px;
  padding: 10px;
}

.sidebar,
.admin-sidebar {
  background: rgba(9, 10, 12, 0.96);
}

.sidebar-top,
.chat-header,
.admin-header {
  border-color: var(--line);
}

.brand-lockup strong,
.admin-header h1 {
  color: var(--ink);
  font-weight: 650;
}

.icon-button {
  font-size: 20px;
}

.prompt-panel,
.history-panel {
  scrollbar-color: var(--surface-4) transparent;
}

.category-card,
.archive-folder {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.category-card[open],
.archive-folder[open] {
  border-color: var(--line-2);
  background: var(--surface-2);
  box-shadow: none;
}

.category-card summary,
.archive-folder summary {
  min-height: 42px;
}

.category-card em,
.archive-folder summary em {
  background: var(--surface-4);
  color: var(--muted);
}

.prompt-card {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
}

.prompt-card:hover {
  border-color: rgba(0, 217, 146, 0.36);
  background: var(--surface-3);
  box-shadow: none;
}

.prompt-title b,
.history-open b,
.archive-title::before {
  color: var(--teal);
  background: var(--teal);
}

.history-row {
  border-radius: 8px;
}

.history-row:hover,
.history-row.active {
  border-color: var(--line-2);
  background: var(--surface-2);
  box-shadow: none;
}

.history-row.active {
  outline: 1px solid rgba(0, 217, 146, 0.2);
}

.history-open span {
  color: var(--ink);
  font-weight: 560;
}

.history-open small {
  color: var(--muted-2);
}

.history-actions button,
.archive-folder-actions button {
  border-radius: 6px;
  color: var(--muted);
}

.history-actions button:hover,
.archive-folder-actions button:hover {
  background: var(--surface-4);
  color: var(--ink);
}

.archive-folder summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.archive-folder-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.archive-folder:hover .archive-folder-actions,
.archive-folder[open] .archive-folder-actions {
  opacity: 1;
  transform: translateX(0);
}

.archive-folder-actions button {
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  font-size: 12px;
}

.archive-folder-body {
  border-top: 1px solid var(--line);
}

.chat-shell {
  background:
    linear-gradient(180deg, rgba(138, 215, 255, 0.035), transparent 240px),
    rgba(10, 11, 13, 0.96);
}

.title-input {
  color: var(--ink);
  font-size: 18px;
  font-weight: 650;
}

.model-trigger,
.user-chip,
.thinking-toggle {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
}

.model-trigger:hover,
.user-chip:hover,
.thinking-toggle:hover {
  border-color: var(--line-2);
  background: var(--surface-3);
}

.model-menu {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.model-menu button {
  color: var(--ink);
}

.model-menu button:hover {
  background: var(--surface-3);
}

.messages {
  background:
    linear-gradient(90deg, transparent 0 24px, rgba(255, 255, 255, 0.018) 24px 25px, transparent 25px 100%),
    transparent;
}

.empty-state {
  color: var(--muted);
}

.empty-state h2 {
  color: var(--ink);
  font-weight: 600;
}

.message {
  animation: messageIn 0.2s ease both;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.avatar {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--clay);
}

.message.user .avatar {
  background: var(--teal-soft);
  color: var(--teal);
}

.bubble {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: #e7ebef;
  box-shadow: none;
}

.message.user .bubble {
  border-color: rgba(0, 217, 146, 0.22);
  background: rgba(0, 217, 146, 0.08);
}

.notice-card {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: none;
}

.notice-card strong {
  color: var(--ink);
}


.bubble pre {
  border: 1px solid var(--line);
  background: #050607;
}

.bubble table th,
.bubble table td {
  border-color: var(--line);
}

.composer {
  border-color: var(--line);
  background: rgba(7, 8, 10, 0.62);
}

.input-wrap {
  border-color: var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.32);
}

.input-wrap:focus-within {
  border-color: rgba(0, 217, 146, 0.42);
  box-shadow: 0 0 0 1px rgba(0, 217, 146, 0.15), 0 20px 60px rgba(0, 0, 0, 0.44);
}

.input-wrap textarea::placeholder {
  color: var(--muted-2);
}

.input-wrap .composer-input.is-empty::before {
  color: var(--muted-2);
}

.attachment,
.credit-row-icon,
.recharge-order {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.toast {
  border-color: rgba(0, 217, 146, 0.24);
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.profile-overlay,
.dialog-overlay {
  background: rgba(0, 0, 0, 0.62);
}

.profile-section,
.profile-grid > div,
.credit-row,
.payment-box,
.recharge-recent,
.recharge-provider,
.recharge-plan,
.archive-folder-choices button,
.admin-section,
.metric-card,
.pricing-row,
.model-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
}

.profile-grid > div span,
.profile-section p,
.credit-dialog-head p,
.credit-row-main span,
.credit-row-main em,
.recharge-provider em,
.recharge-plan em,
.recharge-order em {
  color: var(--muted);
}

.archive-folder-choices button:hover,
.recharge-plan:hover {
  border-color: rgba(0, 217, 146, 0.35);
  background: var(--surface-3);
  box-shadow: none;
}

.archive-new-folder input,
.name-dialog input,
.payment-placeholder {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.admin-nav button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.admin-nav button:hover,
.admin-nav button.active {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.admin-content table {
  color: var(--ink);
}

.admin-content th,
.admin-content td {
  border-color: var(--line);
}

.admin-content th {
  background: var(--surface);
  color: var(--muted);
}

.drag-item,
.prompt-list-item,
.pricing-fields label {
  border-color: var(--line);
  background: var(--surface-2);
}

.category-pills button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}

.category-pills button.active,
.category-pills button:hover {
  border-color: rgba(0, 217, 146, 0.36);
  background: var(--teal-soft);
  color: var(--teal);
}

@media (max-width: 980px) {
  .app-shell,
  .admin-shell {
    padding: 0;
    gap: 0;
  }

  .sidebar,
  .chat-shell,
  .admin-sidebar,
  .admin-main {
    border-radius: 0;
  }

  .archive-new-folder {
    grid-template-columns: 1fr;
  }
}

/* Theme system: Claude/ChatGPT interaction-inspired, readable and persistent. */
html[data-theme="aurora"] {
  color-scheme: dark;
  --page: #090b0f;
  --page-2: #0f1218;
  --surface: #151922;
  --surface-2: #1d2330;
  --surface-3: #252d3a;
  --surface-4: #303949;
  --ink: #f7fafc;
  --muted: #c3ccd8;
  --muted-2: #8d99a8;
  --line: rgba(226, 232, 240, 0.14);
  --line-2: rgba(226, 232, 240, 0.24);
  --teal: #34e5a7;
  --teal-soft: rgba(52, 229, 167, 0.14);
  --clay: #8ad7ff;
  --clay-soft: rgba(138, 215, 255, 0.14);
  --blue: #9fa8ff;
  --danger: #ff7a7a;
  --warning: #ffd166;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.45);
  --panel-alpha: 0.96;
  --bubble: #171c25;
  --bubble-user: #12382c;
  --input-bg: #111720;
}

html[data-theme="sand"] {
  color-scheme: light;
  --page: #f6f1e8;
  --page-2: #eee6d8;
  --surface: #fffaf2;
  --surface-2: #f2eadc;
  --surface-3: #e8dece;
  --surface-4: #d9ccbb;
  --ink: #241f1a;
  --muted: #62594e;
  --muted-2: #8a7f72;
  --line: rgba(74, 63, 52, 0.16);
  --line-2: rgba(74, 63, 52, 0.28);
  --teal: #b96f50;
  --teal-soft: rgba(185, 111, 80, 0.12);
  --clay: #2b6f6a;
  --clay-soft: rgba(43, 111, 106, 0.12);
  --blue: #5d6d8f;
  --danger: #b4443d;
  --warning: #b98221;
  --shadow: 0 24px 70px rgba(74, 63, 52, 0.16);
  --panel-alpha: 0.94;
  --bubble: #fffaf2;
  --bubble-user: #eee2d0;
  --input-bg: #fffaf2;
}

html[data-theme="mono"] {
  color-scheme: light;
  --page: #ffffff;
  --page-2: #f7f7f7;
  --surface: #ffffff;
  --surface-2: #f2f2f2;
  --surface-3: #e8e8e8;
  --surface-4: #d9d9d9;
  --ink: #111111;
  --muted: #555555;
  --muted-2: #777777;
  --line: rgba(0, 0, 0, 0.12);
  --line-2: rgba(0, 0, 0, 0.22);
  --teal: #111111;
  --teal-soft: rgba(0, 0, 0, 0.06);
  --clay: #111111;
  --clay-soft: rgba(0, 0, 0, 0.06);
  --blue: #111111;
  --danger: #b42318;
  --warning: #946200;
  --shadow: 0 22px 64px rgba(0, 0, 0, 0.12);
  --panel-alpha: 0.98;
  --bubble: #ffffff;
  --bubble-user: #f1f1f1;
  --input-bg: #ffffff;
}

html.theme-transitioning *,
html::view-transition-old(root),
html::view-transition-new(root) {
  transition:
    background-color 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

html::view-transition-old(root),
html::view-transition-new(root) {
  animation-duration: 0.42s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

body {
  background:
    radial-gradient(circle at 18% -4%, color-mix(in srgb, var(--teal) 12%, transparent), transparent 28rem),
    linear-gradient(180deg, var(--page), var(--page-2));
  color: var(--ink);
}

html[data-theme="aurora"] body {
  background:
    radial-gradient(circle at 22% -10%, rgba(52, 229, 167, 0.13), transparent 30rem),
    radial-gradient(circle at 84% 8%, rgba(138, 215, 255, 0.1), transparent 26rem),
    linear-gradient(180deg, var(--page), var(--page-2));
}

.sidebar,
.chat-shell,
.admin-sidebar,
.admin-main,
.auth-card,
.profile-panel,
.credit-dialog,
.archive-dialog,
.name-dialog {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.sidebar {
  background: color-mix(in srgb, var(--page) 72%, var(--surface) 28%);
}

.chat-shell {
  background: color-mix(in srgb, var(--surface) 82%, var(--page) 18%);
}

.auth-card h1,
.empty-state h2,
.brand-lockup strong,
.title-input,
.profile-identity strong,
.profile-grid strong,
.profile-section h2,
.credit-row-main strong,
.history-open span,
.prompt-title,
.archive-folder summary span,
.bubble,
.admin-header h1 {
  color: var(--ink);
}

.auth-card p,
.meta,
.eyebrow,
.section-title,
.history-label,
.prompt-card small,
.prompt-card i,
.history-open small,
.profile-identity > span,
.profile-grid span,
.profile-section p,
.credit-dialog-head p,
.credit-row-main span,
.credit-row-main em,
.muted {
  color: var(--muted);
}

input,
textarea,
select,
.input-wrap,
.archive-new-folder input,
.name-dialog input,
.payment-placeholder {
  background: var(--input-bg);
  color: var(--ink);
  border-color: var(--line);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

.primary,
.send-button {
  background: var(--teal);
  border-color: color-mix(in srgb, var(--teal) 76%, var(--line));
  color: color-mix(in srgb, var(--page) 88%, #000);
}

html[data-theme="mono"] .primary,
html[data-theme="mono"] .send-button {
  background: #111;
  color: #fff;
}

.ghost,
.icon-button,
.icon-tool,
.expand-composer,
.model-trigger,
.user-chip,
.thinking-toggle,
.category-card,
.archive-folder,
.prompt-card,
.history-row:hover,
.history-row.active,
.model-menu,
.profile-grid > div,
.profile-section,
.credit-row,
.payment-box,
.recharge-recent,
.recharge-provider,
.recharge-plan,
.archive-folder-choices button,
.admin-section,
.metric-card,
.pricing-row,
.model-card,
.drag-item,
.prompt-list-item {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

.category-card[open],
.archive-folder[open],
.prompt-card:hover,
.model-trigger:hover,
.user-chip:hover,
.thinking-toggle:hover,
.archive-folder-choices button:hover,
.recharge-plan:hover,
.model-menu button:hover,
.admin-nav button:hover,
.admin-nav button.active {
  background: var(--surface-3);
  border-color: var(--line-2);
  color: var(--ink);
}

.bubble {
  background: var(--bubble);
  border-color: var(--line);
}

.message.user .bubble {
  background: var(--bubble-user);
  border-color: color-mix(in srgb, var(--teal) 30%, var(--line));
  color: var(--ink);
}

.avatar,
.user-avatar,
.profile-avatar,
.mark,
.empty-mark,
.brand-mark {
  background: linear-gradient(135deg, var(--teal-soft), var(--clay-soft));
  border-color: color-mix(in srgb, var(--teal) 28%, var(--line));
  color: var(--ink);
}

.thinking-toggle span {
  background: var(--surface-4);
}

.thinking-toggle span::before {
  background: var(--ink);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.22);
}

.thinking-toggle input:checked + span {
  background: var(--teal);
}

.thinking-toggle input:checked + span::before {
  background: color-mix(in srgb, var(--page) 90%, #fff);
}

.theme-panel {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.theme-option {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.theme-option:hover,
.theme-option.active {
  border-color: color-mix(in srgb, var(--teal) 42%, var(--line-2));
  background: var(--surface-3);
}

.theme-option.active {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 14%, transparent);
}

.theme-swatch {
  grid-row: 1 / span 2;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
}

.theme-swatch.aurora {
  background: linear-gradient(135deg, #090b0f 0 42%, #34e5a7 42% 70%, #8ad7ff 70%);
}

.theme-swatch.sand {
  background: linear-gradient(135deg, #f6f1e8 0 42%, #b96f50 42% 70%, #2b6f6a 70%);
}

.theme-swatch.mono {
  background: linear-gradient(135deg, #fff 0 48%, #111 48% 68%, #d9d9d9 68%);
}

.theme-option strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.theme-option em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.profile-panel {
  width: min(420px, calc(100vw - 24px));
}

.profile-section {
  border-radius: 12px;
}

.messages {
  background: transparent;
}

.notice-card,
.toast {
  background: var(--surface-3);
  border-color: var(--line-2);
  color: var(--ink);
}

.admin-content th {
  background: var(--surface-3);
  color: var(--muted);
}

.admin-content td,
.admin-content table {
  color: var(--ink);
}

.profile-row input {
  accent-color: var(--teal);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

/* Chat surface unification pass: reduce center color blocks and make sand the default visual language. */
:root {
  --chat-bg: var(--surface);
  --chat-bg-soft: var(--surface);
  --composer-bg: var(--surface);
  --composer-border: var(--line);
}

html[data-theme="sand"] {
  --page: #f4efe6;
  --page-2: #f4efe6;
  --surface: #fbf6ee;
  --surface-2: #f4efe6;
  --surface-3: #ece3d5;
  --surface-4: #ded2c0;
  --ink: #241f1a;
  --muted: #5f574d;
  --muted-2: #8a7d6d;
  --line: rgba(73, 59, 43, 0.14);
  --line-2: rgba(73, 59, 43, 0.24);
  --bubble: #fbf6ee;
  --bubble-user: #efe5d6;
  --input-bg: #fbf6ee;
  --chat-bg: #fbf6ee;
  --chat-bg-soft: #fbf6ee;
  --composer-bg: #fbf6ee;
  --composer-border: rgba(73, 59, 43, 0.18);
}

html[data-theme="aurora"] {
  --chat-bg: #111720;
  --chat-bg-soft: #111720;
  --composer-bg: #111720;
  --composer-border: rgba(226, 232, 240, 0.14);
}

html[data-theme="mono"] {
  --chat-bg: #ffffff;
  --chat-bg-soft: #ffffff;
  --composer-bg: #ffffff;
  --composer-border: rgba(0, 0, 0, 0.12);
}

body {
  background: var(--page);
}

html[data-theme="aurora"] body {
  background:
    radial-gradient(circle at 18% -8%, rgba(52, 229, 167, 0.11), transparent 26rem),
    var(--page);
}

.app-shell {
  background: var(--page);
}

.chat-shell {
  background: var(--chat-bg) !important;
  border-color: var(--line);
}

.chat-header,
.composer {
  background: var(--chat-bg) !important;
  border-color: var(--line);
}

.messages {
  background: var(--chat-bg) !important;
  padding-top: 30px;
}

.empty-state {
  background: transparent;
}

.message {
  max-width: 880px;
}

.bubble {
  background: var(--bubble) !important;
  border-color: var(--line);
  color: var(--ink);
}

.message.user .bubble {
  background: var(--bubble-user) !important;
  border-color: color-mix(in srgb, var(--teal) 18%, var(--line));
}

.input-wrap {
  background: var(--composer-bg) !important;
  border-color: var(--composer-border);
  box-shadow: 0 18px 46px color-mix(in srgb, var(--ink) 10%, transparent);
}

html[data-theme="sand"] .input-wrap,
html[data-theme="sand"] .bubble,
html[data-theme="sand"] .message.user .bubble {
  box-shadow: 0 10px 30px rgba(73, 59, 43, 0.06);
}

.input-wrap textarea,
.input-wrap .composer-input {
  color: var(--ink);
}

.sidebar {
  background: color-mix(in srgb, var(--page) 70%, var(--surface-2) 30%);
}

html[data-theme="sand"] .sidebar {
  background: #eee6d8;
}

.prompt-panel,
.history-panel {
  background: transparent;
}

.category-card,
.archive-folder,
.prompt-card,
.history-row:hover,
.history-row.active {
  background: color-mix(in srgb, var(--surface) 76%, var(--surface-2) 24%);
}

html[data-theme="sand"] .category-card,
html[data-theme="sand"] .archive-folder,
html[data-theme="sand"] .prompt-card,
html[data-theme="sand"] .history-row:hover,
html[data-theme="sand"] .history-row.active {
  background: #fbf6ee;
}

/* Prompt review, chat comfort, and theme-aware response feedback */
.prompt-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  min-height: 72px;
}

.prompt-card small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prompt-send {
  align-self: center;
  border-radius: 999px;
  padding: 6px 10px;
  min-width: 44px;
  background: var(--ink);
  color: var(--surface);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.prompt-send:hover {
  transform: translateY(-1px);
}

.prompt-thumb {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--teal-soft) 62%, var(--surface));
  border: 1px solid var(--line);
  color: var(--teal);
  font-weight: 800;
}

.prompt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.prompt-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.prompt-actions {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* 我的skill 专属：拖动手柄 + 编辑/删除小按钮 */
.own-skill-card {
  grid-template-columns: 16px 34px minmax(0, 1fr) auto;
  cursor: default;
}

.skill-drag-handle {
  align-self: center;
  cursor: grab;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  letter-spacing: -2px;
  user-select: none;
}

.skill-drag-handle:active {
  cursor: grabbing;
}

.skill-mini-actions {
  display: flex;
  gap: 6px;
}

.skill-mini-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.skill-mini-btn:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--teal-soft) 60%, var(--surface));
}

.skill-mini-btn.danger {
  color: #b4452f;
  border-color: color-mix(in srgb, #b4452f 30%, var(--line));
}

.skill-mini-btn.danger:hover {
  background: color-mix(in srgb, #b4452f 12%, var(--surface));
}

.own-skill-card.skill-dragging {
  opacity: 0.45;
}

.own-skill-card.skill-drop-active {
  outline: 2px dashed var(--teal);
  outline-offset: 2px;
}

.prompt-empty-hint {
  margin: 4px 2px;
  font-size: 12px;
  color: var(--muted);
}

.skill-add-btn {
  width: 100%;
  margin: 4px 2px 2px;
  padding: 8px 10px;
  border: 1px dashed var(--teal);
  border-radius: 10px;
  background: transparent;
  color: var(--teal);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.skill-add-btn:hover {
  background: color-mix(in srgb, var(--teal) 12%, transparent);
}

/* 后台用户 Skill 卡片：图标缩略图 + 复制到提示词库 */
.skill-icon-thumb {
  flex: 0 0 auto;
}

.skill-head-main {
  min-width: 0;
  flex: 1 1 auto;
}

.skill-promote-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.skill-promote-row select {
  min-width: 140px;
}

.message {
  max-width: min(920px, calc(100% - 36px));
  padding-inline: 12px;
  gap: 12px;
}

.message.user {
  align-self: flex-end;
}

.message.assistant {
  align-self: stretch;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.avatar img,
.avatar span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  object-fit: cover;
}

.bubble {
  padding: 16px 18px;
  border-radius: 8px;
  line-height: 1.72;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.06);
}

.message.assistant .bubble {
  max-width: min(760px, 100%);
}

.message.user .bubble {
  max-width: min(680px, 100%);
  padding: 14px 16px;
}


.thinking-stream {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 18px;
}

.thinking-stream span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.38;
  animation: responsePulse 1.4s ease-in-out infinite;
}

.thinking-stream span:nth-child(2) {
  animation-delay: 0.18s;
}

.thinking-stream span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes responsePulse {
  0%, 70%, 100% {
    opacity: 0.28;
    transform: translateY(0) scale(0.86);
  }
  35% {
    opacity: 0.78;
    transform: translateY(-4px) scale(1);
  }
}

.profile-prompt-entry {
  gap: 14px;
}

.profile-prompt-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}


.skill-icon-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
  cursor: pointer;
}

.skill-icon-picker strong,
.skill-icon-picker em {
  display: block;
}

.skill-icon-picker em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  margin-top: 3px;
}

.skill-file-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.skill-file-picker:hover {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal-soft) 40%, var(--surface-2));
}

.skill-file-icon {
  font-size: 20px;
  line-height: 1;
  flex: 0 0 auto;
}

.skill-file-picker strong,
.skill-file-picker em {
  display: block;
}

.skill-file-picker em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  margin-top: 3px;
}

.prompt-submit-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: enterSoft 0.18s ease both;
}

/* 头部固定 */
.skill-dialog-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.skill-dialog-head h2 {
  margin: 0;
  font-size: 18px;
}

.skill-dialog-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

/* 中部唯一滚动区 */
.skill-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px;
}

/* 图标 + 文件 选择器并排,省一行高度 */
.skill-picker-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.skill-picker-text {
  min-width: 0;
}

.skill-picker-text strong,
.skill-picker-text em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-content-label textarea {
  min-height: 150px;
  resize: vertical;
}

/* 底部操作栏始终可见,保存按钮不再需要下拉 */
.skill-dialog-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.skill-foot-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.skill-dialog-foot .primary {
  flex: 0 0 auto;
  min-width: 168px;
}

@media (max-width: 560px) {
  .skill-picker-row {
    grid-template-columns: 1fr;
  }
  .skill-dialog-head,
  .skill-dialog-body,
  .skill-dialog-foot {
    padding-left: 16px;
    padding-right: 16px;
  }
  .skill-dialog-foot {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
  }
  .skill-dialog-foot .primary {
    width: 100%;
  }
  .skill-foot-hint {
    text-align: center;
  }
}

.profile-prompt-form .textarea-label,
.profile-prompt-form .wide {
  grid-column: 1 / -1;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-2);
}

.submission-list,
.review-list {
  display: grid;
  gap: 10px;
}

.submission-item,
.review-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.submission-item strong,
.review-card strong {
  display: block;
  color: var(--ink);
}

.submission-item small,
.submission-item em,
.review-card small {
  display: block;
  color: var(--muted);
  font-style: normal;
  margin-top: 4px;
}

.review-head,
.admin-header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-head select {
  max-width: 180px;
}

.editor-grid.compact {
  margin-top: 12px;
}

.prompt-icon-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

.prompt-thumb.admin-preview {
  width: 46px;
  height: 46px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--surface-2);
  cursor: pointer;
}

.theme-mini {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: var(--surface-2);
}

.theme-mini button {
  min-width: 34px;
  height: 28px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.theme-mini button.active {
  background: var(--ink);
  color: var(--surface);
}

html[data-theme="sand"] .message.assistant .bubble,
html[data-theme="sand"] .submission-item,
html[data-theme="sand"] .review-card {
  background: rgba(255, 253, 248, 0.95);
}

html[data-theme="sand"] .message.user .bubble {
  background: #efe4d3 !important;
  color: #261c12;
}

html[data-theme="aurora"] .message.assistant .bubble {
  background: rgba(8, 18, 28, 0.9);
}

html[data-theme="aurora"] .message.user .bubble {
  background: rgba(20, 83, 94, 0.72) !important;
}

html[data-theme="aurora"] .avatar {
  background: rgba(14, 27, 38, 0.86);
}

html[data-theme="mono"] .message.assistant .bubble {
  background: #fff;
}

html[data-theme="mono"] .message.user .bubble {
  background: #111 !important;
  color: #fff;
}

html[data-theme="aurora"] {
  color-scheme: dark;
  --page: #071016;
  --page-2: #0d151d;
  --surface: rgba(18, 26, 34, 0.96);
  --surface-2: rgba(24, 34, 43, 0.94);
  --ink: #f4f7f8;
  --muted: #b8c4cb;
  --line: rgba(217, 227, 232, 0.18);
  --line-2: rgba(217, 227, 232, 0.28);
  --teal: #7ad7cf;
  --teal-soft: rgba(122, 215, 207, 0.14);
  --bubble: rgba(18, 27, 35, 0.98);
  --bubble-user: rgba(32, 101, 110, 0.9);
  --chat-bg: #0b131a;
  --composer-bg: rgba(19, 28, 36, 0.98);
  --composer-border: rgba(217, 227, 232, 0.18);
}

html[data-theme="aurora"] body {
  background: linear-gradient(135deg, #071016, #0d151d);
  color: var(--ink);
}

html[data-theme="aurora"] input,
html[data-theme="aurora"] textarea,
html[data-theme="aurora"] select {
  background: rgba(10, 18, 25, 0.86);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="aurora"] .prompt-send,
html[data-theme="aurora"] .theme-mini button.active {
  background: #d8f7ef;
  color: #071016;
}

html[data-theme="aurora"] .bubble table {
  background: rgba(9, 16, 22, 0.74);
  color: var(--ink);
}

html[data-theme="aurora"] .bubble th,
html[data-theme="aurora"] .bubble td {
  background: transparent !important;
  color: var(--ink) !important;
  border-color: rgba(217, 227, 232, 0.22);
}

html[data-theme="aurora"] .bubble th {
  background: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="aurora"] .bubble [style*="color"],
html[data-theme="aurora"] .bubble [style*="background"] {
  color: var(--ink) !important;
  background-color: transparent !important;
}

html[data-theme="aurora"] .bubble pre,
html[data-theme="aurora"] .bubble code {
  background: #050a0f;
  color: #eef6f8;
}

html[data-theme="mono"] .bubble table {
  background: #fff;
  color: #111;
}

html[data-theme="mono"] .bubble th,
html[data-theme="mono"] .bubble td {
  background: transparent !important;
  color: #111 !important;
}

html[data-theme="mono"] .message.user .bubble table,
html[data-theme="mono"] .message.user .bubble th,
html[data-theme="mono"] .message.user .bubble td {
  background: transparent !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.28);
}

/* Left navigation polish and high-contrast dark theme reset */
.section-title,
.history-label {
  color: var(--ink);
  font-weight: 850;
  letter-spacing: 0;
}

.section-title::before,
.history-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 7px;
  vertical-align: 1px;
  background: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 12%, transparent);
}

.prompt-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.prompt-title .title-icon-mark,
.prompt-title b {
  width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: color-mix(in srgb, var(--teal) 12%, transparent) !important;
  color: var(--teal) !important;
  border: 1px solid color-mix(in srgb, var(--teal) 28%, var(--line));
  font-size: 10px;
  line-height: 1;
  margin: 0;
}

.history-open small {
  gap: 8px;
}

.history-open b {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 1px 7px;
  background: color-mix(in srgb, var(--teal) 10%, transparent) !important;
  color: var(--teal) !important;
  border: 1px solid color-mix(in srgb, var(--teal) 22%, var(--line));
  font-size: 11px;
  font-weight: 750;
}

html[data-theme="aurora"] {
  color-scheme: dark;
  --page: #080b12;
  --page-2: #10151d;
  --surface: rgba(18, 23, 31, 0.96);
  --surface-2: rgba(24, 30, 39, 0.96);
  --surface-3: rgba(31, 39, 50, 0.98);
  --surface-4: rgba(43, 53, 66, 0.92);
  --ink: #f7fafc;
  --muted: #c9d2dc;
  --muted-2: #a8b4c0;
  --line: rgba(224, 232, 240, 0.18);
  --line-2: rgba(224, 232, 240, 0.32);
  --teal: #f2c96d;
  --teal-soft: rgba(242, 201, 109, 0.16);
  --clay: #82d7ff;
  --clay-soft: rgba(130, 215, 255, 0.14);
  --blue: #9ab7ff;
  --bubble: rgba(20, 26, 35, 0.98);
  --bubble-user: rgba(50, 43, 28, 0.98);
  --chat-bg: #0d1118;
  --composer-bg: rgba(19, 25, 34, 0.98);
  --composer-border: rgba(224, 232, 240, 0.2);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
}

html[data-theme="aurora"] body {
  background:
    radial-gradient(circle at 16% -8%, rgba(242, 201, 109, 0.1), transparent 26rem),
    radial-gradient(circle at 92% 0%, rgba(130, 215, 255, 0.08), transparent 24rem),
    linear-gradient(135deg, #080b12, #10151d);
  color: var(--ink);
}

html[data-theme="aurora"] .sidebar {
  background: #0b0f16;
  border-color: rgba(224, 232, 240, 0.14);
}

html[data-theme="aurora"] .brand-lockup strong,
html[data-theme="aurora"] .category-card summary span,
html[data-theme="aurora"] .archive-folder summary span,
html[data-theme="aurora"] .history-open span,
html[data-theme="aurora"] .prompt-title,
html[data-theme="aurora"] .title-input,
html[data-theme="aurora"] .admin-header h1,
html[data-theme="aurora"] .profile-identity strong,
html[data-theme="aurora"] .profile-section h2,
html[data-theme="aurora"] .section-title,
html[data-theme="aurora"] .history-label {
  color: var(--ink) !important;
}

html[data-theme="aurora"] .eyebrow,
html[data-theme="aurora"] .prompt-card small,
html[data-theme="aurora"] .prompt-card i,
html[data-theme="aurora"] .history-open small,
html[data-theme="aurora"] .meta,
html[data-theme="aurora"] .profile-section p {
  color: var(--muted) !important;
}

html[data-theme="aurora"] .category-card,
html[data-theme="aurora"] .archive-folder,
html[data-theme="aurora"] .prompt-card,
html[data-theme="aurora"] .history-row,
html[data-theme="aurora"] .profile-section,
html[data-theme="aurora"] .profile-grid > div,
html[data-theme="aurora"] .admin-section {
  background: rgba(21, 27, 36, 0.92) !important;
  border-color: rgba(224, 232, 240, 0.14) !important;
  box-shadow: none;
}

html[data-theme="aurora"] .category-card[open],
html[data-theme="aurora"] .archive-folder[open],
html[data-theme="aurora"] .prompt-card:hover,
html[data-theme="aurora"] .history-row:hover,
html[data-theme="aurora"] .history-row.active {
  background: rgba(30, 38, 49, 0.98) !important;
  border-color: rgba(242, 201, 109, 0.34) !important;
}

html[data-theme="aurora"] .history-row.active {
  outline: 1px solid rgba(242, 201, 109, 0.24);
}

html[data-theme="aurora"] .category-card em,
html[data-theme="aurora"] .archive-folder summary em {
  background: rgba(242, 201, 109, 0.14) !important;
  color: #f6d891 !important;
}

html[data-theme="aurora"] .prompt-thumb {
  background: rgba(242, 201, 109, 0.12);
  color: #f6d891;
  border-color: rgba(242, 201, 109, 0.28);
}

html[data-theme="aurora"] .prompt-send,
html[data-theme="aurora"] .theme-mini button.active {
  background: #f2c96d !important;
  color: #111827 !important;
  border-color: rgba(242, 201, 109, 0.72);
}

html[data-theme="aurora"] .chat-shell,
html[data-theme="aurora"] .chat-header,
html[data-theme="aurora"] .composer,
html[data-theme="aurora"] .messages {
  background: var(--chat-bg) !important;
}

html[data-theme="aurora"] .bubble,
html[data-theme="aurora"] .message.assistant .bubble {
  background: rgba(20, 26, 35, 0.98) !important;
  color: var(--ink) !important;
  border-color: rgba(224, 232, 240, 0.16);
}

html[data-theme="aurora"] .message.user .bubble {
  background: rgba(50, 43, 28, 0.98) !important;
  color: #fff8e8 !important;
  border-color: rgba(242, 201, 109, 0.24);
}

html[data-theme="aurora"] input,
html[data-theme="aurora"] textarea,
html[data-theme="aurora"] select,
html[data-theme="aurora"] .input-wrap {
  background: rgba(16, 22, 30, 0.98) !important;
  color: var(--ink) !important;
  border-color: rgba(224, 232, 240, 0.18) !important;
}

html[data-theme="aurora"] .bubble table {
  background: #111821 !important;
  color: var(--ink) !important;
}

html[data-theme="aurora"] .bubble th,
html[data-theme="aurora"] .bubble td {
  background: transparent !important;
  color: var(--ink) !important;
  border-color: rgba(224, 232, 240, 0.22) !important;
}

html[data-theme="aurora"] .bubble th {
  background: rgba(242, 201, 109, 0.12) !important;
  color: #ffe2a0 !important;
}

html[data-theme="aurora"] .bubble [style*="color"],
html[data-theme="aurora"] .bubble [style*="background"] {
  color: var(--ink) !important;
  background-color: transparent !important;
}

@media (max-width: 720px) {
  .message {
    max-width: 100%;
    padding-inline: 4px;
  }

  .profile-prompt-form {
    grid-template-columns: 1fr;
  }

  .prompt-card {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .prompt-send {
    grid-column: 2;
    justify-self: start;
  }

  .review-head,
  .admin-header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .review-head select {
    max-width: none;
  }
}

/* Current chat, guide, upload and crop refinements */
.messages {
  padding: 34px max(22px, 11vw) 22px !important;
}

.message,
.message.user,
.message.assistant {
  width: min(860px, 100%);
  max-width: min(860px, calc(100% - 20px)) !important;
  margin: 0 auto 24px !important;
  align-self: stretch !important;
  grid-template-columns: 34px minmax(0, 1fr) !important;
  align-items: start;
}

.message.user .bubble,
.message.assistant .bubble {
  width: auto !important;
  max-width: min(760px, 100%) !important;
  margin-left: 0 !important;
}

.message.user .bubble {
  background: color-mix(in srgb, var(--surface-2) 82%, var(--clay-soft)) !important;
  color: var(--ink) !important;
  border: 1px solid color-mix(in srgb, var(--clay) 16%, var(--line)) !important;
  padding: 12px 15px !important;
}

.message.assistant .bubble {
  padding: 7px 0 !important;
}

.usage-guide-trigger {
  min-width: 132px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--teal) 24%, var(--line));
  border-radius: 999px;
  background:
    radial-gradient(circle at 16% 20%, color-mix(in srgb, var(--teal) 18%, transparent), transparent 52%),
    color-mix(in srgb, var(--surface) 88%, var(--teal-soft));
  color: var(--ink);
  padding: 5px 7px 5px 14px;
  font-size: 13px;
  font-weight: 820;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.usage-guide-trigger i {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font-style: normal;
  font-size: 12px;
}

.usage-guide-dialog {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid color-mix(in srgb, var(--teal) 22%, var(--line));
  border-radius: 28px;
  background:
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--teal) 20%, transparent), transparent 15rem),
    linear-gradient(145deg, var(--surface), var(--surface-2));
  color: var(--ink);
  padding: 22px;
  box-shadow: var(--shadow);
}

.usage-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.usage-guide-head span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.usage-guide-dialog h2 {
  margin: 12px 0 14px;
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: -0.05em;
}

.usage-guide-body {
  display: grid;
  gap: 10px;
}

.usage-guide-body p {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-3) 54%, transparent);
  color: var(--muted);
  line-height: 1.7;
}

.avatar-crop-dialog {
  width: min(430px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow);
}

.avatar-crop-stage {
  display: grid;
  place-items: center;
  padding: 16px 0 12px;
}

.avatar-crop-frame {
  position: relative;
  width: min(280px, 72vw);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--line) 42%, transparent) 25%, transparent 25% 75%, color-mix(in srgb, var(--line) 42%, transparent) 75%),
    linear-gradient(45deg, color-mix(in srgb, var(--line) 42%, transparent) 25%, transparent 25% 75%, color-mix(in srgb, var(--line) 42%, transparent) 75%);
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
  border: 4px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 18px 44px rgba(15, 23, 42, 0.16);
  touch-action: none;
  cursor: grab;
}

.avatar-crop-frame:active {
  cursor: grabbing;
}

.avatar-crop-frame img {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  user-select: none;
  pointer-events: none;
}

.avatar-crop-frame::after {
  content: "";
  position: absolute;
  inset: 14%;
  border: 1px dashed rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.08);
  pointer-events: none;
}

.avatar-zoom-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.avatar-zoom-row input {
  width: 100%;
}

.settings-editor .usage-guide-preview {
  margin-top: 14px;
  display: grid;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--teal) 22%, var(--line));
  border-radius: 22px;
  background:
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--teal) 18%, transparent), transparent 12rem),
    var(--surface-2);
  padding: 16px;
}

.settings-editor .usage-guide-preview span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.settings-editor .usage-guide-preview strong {
  font-size: 22px;
  letter-spacing: -0.04em;
}

.settings-editor .usage-guide-preview p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-wrap;
}

.brand-asset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
  margin: 12px 0 18px;
}

.brand-asset-uploader {
  display: grid;
  gap: 10px;
  justify-items: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 12px;
  cursor: pointer;
}

.brand-asset-uploader span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.brand-asset-uploader img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 12px;
  background: white;
  box-shadow: inset 0 0 0 1px var(--line);
}

@media (max-width: 720px) {
  .header-actions {
    justify-content: flex-start;
  }

  .usage-guide-trigger,
  .model-trigger {
    min-width: 0;
    width: 100%;
  }

  .message,
  .message.user,
  .message.assistant {
    max-width: 100% !important;
    grid-template-columns: 30px minmax(0, 1fr) !important;
    padding-inline: 0 !important;
  }
}

/* Chat composition pass: quieter selection state, better reading margins, GPT-like thinking. */
.chat-shell {
  --chat-measure: min(1080px, calc(100vw - 340px));
  --chat-side-pad: clamp(34px, 8vw, 120px);
}

.messages {
  padding: clamp(34px, 6vh, 62px) var(--chat-side-pad) 32px !important;
  scroll-padding-block: 40px;
}

.message,
.message.user,
.message.assistant,
.message.notice {
  width: var(--chat-measure) !important;
  max-width: calc(100% - 8px) !important;
  padding-inline: 0 !important;
  margin: 0 auto 28px !important;
}

.message {
  gap: 14px !important;
}

.message.notice {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) !important;
}

.message.notice::before {
  content: none;
}

.notice-card {
  width: min(560px, 100%) !important;
  max-width: 100% !important;
  margin: 0 !important;
  position: relative;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 5px 12px !important;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--teal) 18%, var(--line)) !important;
  border-radius: 18px !important;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal) 9%, transparent), transparent 58%),
    color-mix(in srgb, var(--surface) 76%, var(--surface-2)) !important;
  color: var(--ink) !important;
  padding: 13px 16px 14px !important;
  box-shadow: 0 18px 46px color-mix(in srgb, var(--ink) 8%, transparent) !important;
  overflow: hidden;
}

.notice-card::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--teal), color-mix(in srgb, var(--clay) 70%, var(--teal)), transparent);
  opacity: 0.72;
}

.notice-card .notice-kicker {
  grid-column: 1 / -1;
  color: var(--teal) !important;
  font-size: 11px !important;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.notice-card strong {
  min-width: 0;
  color: var(--ink) !important;
  font-size: 16px !important;
  font-weight: 820;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-card em {
  align-self: center;
  border: 1px solid color-mix(in srgb, var(--teal) 20%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--teal) 9%, transparent);
  color: var(--muted) !important;
  padding: 4px 9px;
  font-size: 12px !important;
  font-style: normal;
  white-space: nowrap;
}

.message.assistant .bubble {
  max-width: min(780px, 100%) !important;
}

.message.user .bubble {
  max-width: min(700px, 100%) !important;
}

.message.waiting .bubble,
.message.waiting.assistant .bubble {
  width: auto !important;
  max-width: min(520px, 100%) !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 3px 0 0 !important;
}


.thinking-stream {
  display: none !important;
}

@keyframes thinkingOrbit {
  0%, 100% {
    opacity: 0.36;
    scale: 0.72;
  }
  45% {
    opacity: 1;
    scale: 1.08;
  }
}

@keyframes thinkingRing {
  0% {
    opacity: 0.54;
    transform: scale(0.72);
  }
  72%, 100% {
    opacity: 0;
    transform: scale(1.7);
  }
}

@keyframes thinkingLine {
  0%, 30% {
    transform: translateX(-115%);
  }
  82%, 100% {
    transform: translateX(115%);
  }
}

html[data-theme="sand"] .notice-card {
  background:
    linear-gradient(135deg, rgba(185, 111, 80, 0.1), transparent 58%),
    #fffaf2 !important;
  box-shadow: 0 18px 46px rgba(73, 59, 43, 0.08) !important;
}

html[data-theme="aurora"] .notice-card {
  background:
    linear-gradient(135deg, rgba(242, 201, 109, 0.12), transparent 58%),
    rgba(20, 26, 35, 0.94) !important;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.2) !important;
}

html[data-theme="mono"] .notice-card {
  background: #fff !important;
  border-color: rgba(0, 0, 0, 0.14) !important;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.06) !important;
}

html[data-theme="mono"] .notice-card::before {
  background: linear-gradient(90deg, #111, rgba(0, 0, 0, 0.28), transparent);
}

@media (max-width: 980px) {
  .chat-shell {
    --chat-measure: min(1080px, calc(100vw - 44px));
    --chat-side-pad: clamp(18px, 5vw, 42px);
  }
}

@media (max-width: 720px) {
  .messages {
    padding: 24px 16px 24px !important;
  }

  .message,
  .message.user,
  .message.assistant,
  .message.notice {
    width: 100% !important;
    max-width: 100% !important;
  }

  .message.notice {
    grid-template-columns: 32px minmax(0, 1fr) !important;
  }

  .message.notice::before {
    content: none;
  }

  .notice-card {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .notice-card em {
    width: fit-content;
  }

  
}

/* Assistant answer typography pass: comfortable GPT-style reading surface. */
.message.assistant:not(.waiting) .bubble {
  width: min(780px, 100%) !important;
  max-width: min(780px, 100%) !important;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent) !important;
  border-radius: 22px !important;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 72%, var(--surface))) !important;
  color: var(--ink) !important;
  padding: 24px 28px !important;
  line-height: 1.78;
  font-size: 15.5px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  box-shadow: 0 18px 48px color-mix(in srgb, var(--ink) 7%, transparent) !important;
}

.message.assistant:not(.waiting) .bubble > :first-child {
  margin-top: 0 !important;
}

.message.assistant:not(.waiting) .bubble > :last-child {
  margin-bottom: 0 !important;
}

.message.assistant:not(.waiting) .bubble p {
  margin: 0 0 0.95em;
}

.message.assistant:not(.waiting) .bubble h1,
.message.assistant:not(.waiting) .bubble h2,
.message.assistant:not(.waiting) .bubble h3,
.message.assistant:not(.waiting) .bubble h4 {
  color: var(--ink);
  line-height: 1.32;
  letter-spacing: -0.02em;
  margin: 1.45em 0 0.65em;
}

.message.assistant:not(.waiting) .bubble h1 {
  font-size: 1.55em;
}

.message.assistant:not(.waiting) .bubble h2 {
  font-size: 1.32em;
}

.message.assistant:not(.waiting) .bubble h3 {
  font-size: 1.14em;
}

.message.assistant:not(.waiting) .bubble ul,
.message.assistant:not(.waiting) .bubble ol {
  margin: 0.3em 0 1.05em;
  padding-left: 1.35em;
}

.message.assistant:not(.waiting) .bubble li {
  margin: 0.32em 0;
  padding-left: 0.12em;
}

.message.assistant:not(.waiting) .bubble li::marker {
  color: var(--muted);
}

.message.assistant:not(.waiting) .bubble blockquote {
  margin: 1.05em 0;
  border-left: 3px solid color-mix(in srgb, var(--teal) 58%, var(--line));
  border-radius: 0 14px 14px 0;
  background: color-mix(in srgb, var(--teal) 7%, transparent);
  color: color-mix(in srgb, var(--ink) 82%, var(--muted));
  padding: 11px 14px;
}

.message.assistant:not(.waiting) .bubble code:not(pre code) {
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-3) 66%, transparent);
  color: var(--ink);
  padding: 0.12em 0.36em;
  font-size: 0.92em;
}

.message.assistant:not(.waiting) .bubble pre {
  margin: 1.1em 0;
  border: 0;
  border-radius: 16px;
  background: var(--code-bg) !important;
  color: var(--code-ink) !important;
  padding: 16px 18px;
  line-height: 1.62;
}

.message.assistant:not(.waiting) .bubble pre code {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
}

.message.assistant:not(.waiting) .bubble table {
  margin: 1.1em 0;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) 82%, var(--surface-2));
}

.message.assistant:not(.waiting) .bubble th,
.message.assistant:not(.waiting) .bubble td {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  vertical-align: top;
}

.message.assistant:not(.waiting) .bubble tr:last-child td {
  border-bottom: 0;
}

.message.assistant:not(.waiting) .bubble th {
  background: color-mix(in srgb, var(--surface-3) 64%, transparent);
  color: var(--ink);
  font-weight: 760;
}

.message.assistant:not(.waiting) .bubble hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.35em 0;
}

html[data-theme="sand"] .message.assistant:not(.waiting) .bubble {
  background: #fffaf2 !important;
  box-shadow: 0 18px 48px rgba(73, 59, 43, 0.08) !important;
}

html[data-theme="aurora"] .message.assistant:not(.waiting) .bubble {
  background:
    linear-gradient(180deg, rgba(20, 26, 35, 0.98), rgba(17, 23, 32, 0.98)) !important;
  border-color: rgba(224, 232, 240, 0.15) !important;
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.22) !important;
}

html[data-theme="mono"] .message.assistant:not(.waiting) .bubble {
  background: #fff !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.055) !important;
}

@media (max-width: 720px) {
  .message.assistant:not(.waiting) .bubble {
    padding: 20px 18px !important;
    border-radius: 18px !important;
    font-size: 15px;
  }
}

/* Drag-to-archive interaction */
.history-row[draggable="true"] {
  cursor: grab;
}

.history-row[draggable="true"]:active {
  cursor: grabbing;
}

.history-row.dragging {
  opacity: 0.46;
  transform: scale(0.985);
}

body.dragging-conversation .archive-section {
  position: relative;
}

body.dragging-conversation .archive-section::after {
  content: "松开即可归档";
  position: sticky;
  bottom: 8px;
  z-index: 2;
  display: block;
  margin: 8px;
  border: 1px solid color-mix(in srgb, var(--teal) 30%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, var(--teal-soft));
  color: var(--teal);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.archive-title {
  justify-content: space-between;
}

.archive-title span {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.archive-drop-empty {
  display: grid;
  gap: 3px;
  margin: 0 6px 8px;
  border: 1px dashed color-mix(in srgb, var(--teal) 28%, var(--line));
  border-radius: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal) 9%, transparent), transparent 64%),
    color-mix(in srgb, var(--surface) 70%, var(--surface-2));
  color: var(--ink);
  padding: 12px;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.archive-drop-empty.compact {
  padding: 10px 12px;
}

.archive-drop-empty strong,
.archive-drop-empty small,
.archive-empty-folder {
  display: block;
}

.archive-drop-empty strong {
  font-size: 13px;
}

.archive-drop-empty small,
.archive-empty-folder {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.archive-empty-folder {
  padding: 10px 8px;
}

.archive-folder.archive-drop-active,
.archive-drop-empty.archive-drop-active {
  border-color: color-mix(in srgb, var(--teal) 62%, var(--line)) !important;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal) 18%, transparent), transparent 62%),
    color-mix(in srgb, var(--surface) 70%, var(--teal-soft)) !important;
  box-shadow: 0 14px 34px color-mix(in srgb, var(--teal) 13%, transparent) !important;
  transform: translateY(-1px);
}

.archive-folder.archive-drop-active summary span,
.archive-drop-empty.archive-drop-active strong {
  color: var(--teal) !important;
}

.archive-folder[draggable="true"] > summary {
  cursor: grab;
}

.archive-folder[draggable="true"] > summary:active {
  cursor: grabbing;
}

.archive-folder.folder-dragging {
  opacity: 0.46;
  transform: scale(0.985);
}

body.dragging-archive-folder .archive-folder {
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.archive-folder.archive-folder-sort-target {
  position: relative;
  border-color: color-mix(in srgb, var(--teal) 50%, var(--line)) !important;
}

.archive-folder.archive-folder-sort-target::before,
.archive-folder.archive-folder-sort-target::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  height: 3px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 13%, transparent);
  opacity: 0;
  pointer-events: none;
}

.archive-folder.archive-folder-sort-target.before::before {
  top: -5px;
  opacity: 1;
}

.archive-folder.archive-folder-sort-target.after::after {
  bottom: -5px;
  opacity: 1;
}

body.dragging-archive-folder .archive-title span {
  color: var(--teal);
}

html[data-theme="aurora"] .archive-drop-empty {
  background:
    linear-gradient(135deg, rgba(242, 201, 109, 0.08), transparent 64%),
    rgba(21, 27, 36, 0.92);
}

html[data-theme="sand"] .archive-drop-empty {
  background:
    linear-gradient(135deg, rgba(185, 111, 80, 0.08), transparent 64%),
    #fbf6ee;
}

html[data-theme="mono"] .archive-drop-empty {
  background: #fff;
}

/* Theme-aware deep-thinking switch: no blue focus ring or foreign border. */
.thinking-toggle,
.thinking-toggle:has(input:checked) {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--muted) !important;
}

.thinking-toggle span {
  width: 52px !important;
  height: 28px !important;
  border: 1px solid color-mix(in srgb, var(--ink) 12%, var(--line)) !important;
  background: color-mix(in srgb, var(--surface-3) 72%, var(--surface-2)) !important;
  box-shadow: inset 0 1px 2px color-mix(in srgb, var(--ink) 8%, transparent) !important;
}

.thinking-toggle span::before {
  width: 22px !important;
  height: 22px !important;
  background: color-mix(in srgb, var(--surface) 84%, #fff) !important;
  box-shadow: 0 3px 9px color-mix(in srgb, var(--ink) 18%, transparent) !important;
}

.thinking-toggle input:focus,
.thinking-toggle input:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.thinking-toggle:focus-within span {
  border-color: color-mix(in srgb, var(--teal) 34%, var(--line)) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 10%, transparent) !important;
}

.thinking-toggle input:checked + span {
  border-color: color-mix(in srgb, var(--teal) 48%, var(--line)) !important;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal) 78%, var(--surface-3)), color-mix(in srgb, var(--clay) 34%, var(--teal))) !important;
}

.thinking-toggle input:checked + span::before {
  background: color-mix(in srgb, var(--surface) 92%, #fff) !important;
  transform: translateX(24px) !important;
}

html[data-theme="sand"] .thinking-toggle span {
  background: #e5dac9 !important;
  border-color: rgba(73, 59, 43, 0.18) !important;
}

html[data-theme="sand"] .thinking-toggle input:checked + span {
  background: linear-gradient(135deg, #b96f50, #9f664c) !important;
  border-color: rgba(185, 111, 80, 0.44) !important;
}

html[data-theme="aurora"] .thinking-toggle span {
  background: rgba(31, 39, 50, 0.98) !important;
  border-color: rgba(224, 232, 240, 0.16) !important;
}

html[data-theme="aurora"] .thinking-toggle input:checked + span {
  background: linear-gradient(135deg, #f2c96d, #b98f39) !important;
  border-color: rgba(242, 201, 109, 0.54) !important;
}

html[data-theme="mono"] .thinking-toggle span {
  background: #e8e8e8 !important;
  border-color: rgba(0, 0, 0, 0.14) !important;
}

html[data-theme="mono"] .thinking-toggle input:checked + span {
  background: #111 !important;
  border-color: #111 !important;
}

/* Right rail, archive drag, and account admin refinements */
.app-shell {
  grid-template-columns: 300px minmax(0, 1fr) 328px;
}

.history-panel {
  flex: initial;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 12px 12px 12px 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 86%, var(--page) 14%);
  box-shadow: 0 18px 54px color-mix(in srgb, #000 12%, transparent);
  overflow: hidden;
}

.history-panel .section-title {
  flex: 0 0 auto;
  margin: 18px 18px 10px;
}

.history-list {
  min-height: 0;
  overflow: auto;
  padding: 0 12px 16px;
}

.sidebar .prompt-panel {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.archive-folder summary {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  align-items: center;
}

.archive-folder summary::before {
  display: none;
}

.archive-folder-handle {
  width: 22px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  cursor: grab;
  user-select: none;
}

.archive-folder-handle:hover {
  background: color-mix(in srgb, var(--teal) 10%, transparent);
  color: var(--teal);
}

.archive-folder-handle:active {
  cursor: grabbing;
}

.archive-folder-body.archive-drop-active {
  border-radius: 12px;
  background: color-mix(in srgb, var(--teal) 10%, transparent);
  outline: 1px dashed color-mix(in srgb, var(--teal) 38%, var(--line));
  outline-offset: -4px;
}

.history-row.archive-row-sort-target {
  position: relative;
}

.history-row.archive-row-sort-target::before,
.history-row.archive-row-sort-target::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 3px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 14%, transparent);
  opacity: 0;
  pointer-events: none;
}

.history-row.archive-row-sort-target.before::before {
  top: -4px;
  opacity: 1;
}

.history-row.archive-row-sort-target.after::after {
  bottom: -4px;
  opacity: 1;
}

.history-row.archive-row-sort-target.before {
  margin-top: 16px;
}

.history-row.archive-row-sort-target.after {
  margin-bottom: 16px;
}

.history-row.archive-row-sort-target::before,
.history-row.archive-row-sort-target::after {
  left: 8px;
  right: 8px;
  height: 4px;
  z-index: 5;
  background: linear-gradient(90deg, transparent, var(--teal) 12%, var(--teal) 88%, transparent);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--teal) 13%, transparent),
    0 10px 24px color-mix(in srgb, var(--teal) 22%, transparent);
}

.history-row.archive-row-sort-target.before::before {
  top: -10px;
}

.history-row.archive-row-sort-target.after::after {
  bottom: -10px;
}

.archive-folder.archive-folder-sort-target.before {
  margin-top: 16px;
}

.archive-folder.archive-folder-sort-target.after {
  margin-bottom: 16px;
}

.archive-folder.archive-folder-sort-target.before::before {
  top: -10px;
}

.archive-folder.archive-folder-sort-target.after::after {
  bottom: -10px;
}


.admin-danger-note {
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.account-admin-layout {
  display: grid;
  gap: 14px;
}

.account-control-panel .section-row {
  align-items: flex-start;
}

.invite-create-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.3fr) minmax(150px, 0.8fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.admin-search {
  min-width: min(360px, 100%);
}

.invite-grid {
  display: grid;
  gap: 10px;
}

.invite-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.invite-card.disabled {
  opacity: 0.65;
}

.invite-card-head,
.review-head-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}


.invite-card label {
  color: var(--muted);
  font-size: 12px;
}

.invite-card input,
.invite-card select,
.admin-search,
.invite-create-row input {
  width: 100%;
}

.user-management-table th,
.user-management-table td {
  vertical-align: middle;
  padding: 9px 10px;
}

.user-management-table td strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
}

.user-management-table td small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  margin-top: 2px;
  white-space: nowrap;
}

.user-usage-summary {
  display: grid;
  gap: 2px;
  min-width: 126px;
}

.user-credit-inline {
  display: grid;
  grid-template-columns: 92px 38px 38px;
  gap: 6px;
  align-items: center;
  min-width: 186px;
}

.user-credit-inline input {
  width: 100%;
}

.user-credit-inline button {
  min-width: 0;
  padding-inline: 10px;
}

.user-management-table .danger {
  white-space: nowrap;
}

.user-password-cell {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
  min-width: 180px;
}

.user-password-cell input {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.user-password-cell button {
  min-width: 0;
  padding-inline: 10px;
  white-space: nowrap;
}


.compact-review-card .review-excerpt {
  color: var(--muted);
  margin: 10px 0 0;
  line-height: 1.55;
}

.compact-review-card .review-detail {
  display: none;
  margin-top: 12px;
}

.compact-review-card.expanded .review-detail {
  display: block;
}

@media (max-width: 1100px) {
  .invite-create-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .invite-create-row {
    grid-template-columns: 1fr;
  }
}

html[data-theme="sand"] .history-panel {
  background: #f7efe4;
  box-shadow: 0 18px 54px rgba(73, 59, 43, 0.11);
}

html[data-theme="aurora"] .history-panel {
  background: #0b0f16;
  border-color: rgba(224, 232, 240, 0.14);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr) 300px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .history-panel {
    max-height: 34vh;
    margin: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
  }

  .history-list {
    padding-bottom: 12px;
  }
}

/* Adaptive shell pass: keep the app usable in narrow floating browser windows. */
.app-shell {
  grid-template-columns: minmax(220px, 18vw) minmax(420px, 1fr) minmax(240px, 20vw);
  min-width: 0;
}

.sidebar,
.history-panel,
.chat-shell {
  min-width: 0;
}

.chat-shell {
  --chat-measure: min(1080px, 100%);
  --chat-side-pad: clamp(16px, 4vw, 88px);
}

.title-block,
.header-actions,
.model-picker,
.user-chip {
  min-width: 0;
}

.title-input {
  width: min(560px, 100%);
}

.model-trigger {
  min-width: min(230px, 42vw);
  max-width: 100%;
}

.composer.expanded .input-wrap,
.input-wrap {
  width: min(100%, var(--chat-measure));
  max-width: min(100%, var(--chat-measure));
  margin-inline: auto;
}

@media (max-width: 1320px) {
  .app-shell {
    grid-template-columns: 260px minmax(380px, 1fr) 280px;
  }

  .chat-shell {
    --chat-side-pad: clamp(16px, 3vw, 48px);
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 236px minmax(360px, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(160px, 28vh);
  }

  .history-panel {
    grid-column: 1 / -1;
    margin: 0 10px 10px;
    border-radius: 16px;
  }

  .history-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 300px);
    align-items: start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 12px 12px;
  }

  .archive-section {
    min-width: 260px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    height: auto;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(60dvh, 1fr) auto;
    padding: 0;
    gap: 0;
  }

  .sidebar,
  .chat-shell,
  .history-panel {
    border-radius: 0;
  }

  .sidebar {
    max-height: 42dvh;
  }

  .chat-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .model-picker,
  .model-trigger,
  .user-chip,
  .usage-guide-trigger {
    width: 100%;
  }

  .messages {
    padding: 22px 14px 22px !important;
  }

  .message,
  .message.user,
  .message.assistant,
  .message.notice {
    width: 100% !important;
    max-width: 100% !important;
  }

  .composer {
    padding: 10px 12px 14px;
  }

  .history-panel {
    max-height: 34dvh;
    margin: 0;
  }

  .history-list {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }
}

/* User-resizable three-column workspace. */
:root {
  --left-rail-width: 328px;
  --right-rail-width: 328px;
  --layout-resizer-width: 8px;
}

.app-shell {
  grid-template-columns:
    minmax(240px, var(--left-rail-width))
    var(--layout-resizer-width)
    minmax(420px, 1fr)
    var(--layout-resizer-width)
    minmax(240px, var(--right-rail-width)) !important;
  gap: 0 !important;
}

.layout-resizer {
  align-self: stretch;
  margin: 18px 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
  position: relative;
  touch-action: none;
  z-index: 20;
}

.layout-resizer::before {
  content: "";
  position: absolute;
  inset: 10px 2px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 76%, transparent);
  opacity: 0;
  transition: opacity 0.16s ease, background 0.16s ease;
}

.layout-resizer:hover::before,
.layout-resizer:focus-visible::before,
body.resizing-layout .layout-resizer::before {
  opacity: 1;
  background: color-mix(in srgb, var(--teal) 46%, var(--line));
}

body.resizing-layout {
  cursor: col-resize;
  user-select: none;
}

body.resizing-layout iframe,
body.resizing-layout textarea {
  pointer-events: none;
}

.chat-header {
  display: grid !important;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow: visible;
}

.title-block {
  min-width: 0;
  overflow: hidden;
}

.title-input,
.meta,
.model-trigger,
.usage-guide-trigger,
.user-chip {
  white-space: nowrap;
}

.title-input,
.meta {
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  flex: initial;
  min-width: 0;
  flex-wrap: nowrap !important;
  overflow: visible;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding-bottom: 0;
}

.model-trigger {
  min-width: 176px !important;
  max-width: 240px;
  width: 100%;
}

#modelName,
#userName,
.usage-guide-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip {
  flex: 0 0 auto;
  width: auto !important;
  min-width: 44px;
  max-width: 174px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
}

.user-avatar {
  flex: 0 0 30px;
  width: 30px !important;
  height: 30px !important;
  min-width: 30px;
  overflow: hidden;
  border-radius: 50%;
}

.user-avatar img {
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: cover;
}

.model-picker {
  flex: 0 1 240px;
  min-width: 156px;
  max-width: 240px;
}

.usage-guide-trigger {
  flex: 0 1 auto;
  max-width: 150px;
}

.native-model-select {
  display: none;
}

@media (max-width: 1320px) {
  .model-trigger {
    min-width: 156px !important;
    max-width: 210px;
  }

  .user-chip {
    max-width: 44px;
    padding-inline: 6px;
  }

  #userName {
    display: none;
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 236px minmax(360px, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) minmax(160px, 28vh) !important;
    gap: 10px !important;
  }

  .layout-resizer {
    display: none;
  }

  .history-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto minmax(60dvh, 1fr) auto !important;
    gap: 0 !important;
  }

  .chat-header {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch !important;
    gap: 8px;
  }

  .header-actions {
    justify-content: flex-start;
    max-width: none;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(128px, 1fr) auto auto;
    gap: 8px;
  }

  .model-picker,
  .model-trigger,
  .user-chip,
  .usage-guide-trigger {
    width: auto !important;
  }

  .model-trigger {
    min-width: 128px !important;
    max-width: none;
  }

  .usage-guide-trigger {
    max-width: 42px;
    width: 42px !important;
    padding-inline: 0;
    justify-content: center;
  }

  .usage-guide-trigger span {
    display: none;
  }

.user-chip {
    max-width: 44px;
    width: 44px !important;
    padding-inline: 6px;
  }
}

/* Authentication layout: centered, roomier form without losing mobile fit. */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vh, 56px) clamp(18px, 4vw, 48px);
}

.auth-card {
  width: min(520px, 100%);
  max-width: calc(100vw - 36px);
  margin: auto;
  padding: clamp(30px, 4vw, 44px);
  border-radius: 20px;
}

.auth-card .mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
}

.auth-card h1 {
  margin-top: 22px;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.12;
}

.auth-card p {
  margin-bottom: 28px;
  line-height: 1.6;
}

.auth-card label {
  margin-bottom: 16px;
}

.auth-card input {
  min-height: 46px;
}

.auth-card .primary,
.auth-card .ghost {
  min-height: 46px;
}

@media (max-width: 560px) {
  .auth-shell {
    align-items: center;
    padding: 18px;
  }

  .auth-card {
    max-width: 100%;
    padding: 26px 22px;
    border-radius: 18px;
  }

  .auth-card .mark {
    width: 50px;
    height: 50px;
  }
}

/* Chat workspace final pass: centered, wider conversation rail. */
.chat-shell {
  --chat-measure: min(1180px, calc(100vw - 320px));
  --chat-side-pad: clamp(24px, 5vw, 72px);
  background: color-mix(in srgb, var(--surface) 88%, var(--page) 12%);
}

.messages {
  padding: clamp(28px, 5vh, 52px) var(--chat-side-pad) 30px !important;
  scroll-padding-block: 48px;
}

.message,
.message.user,
.message.assistant,
.message.notice {
  width: min(var(--chat-measure), 100%) !important;
  max-width: min(var(--chat-measure), calc(100% - 2px)) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 26px !important;
  box-sizing: border-box;
}

.message {
  gap: 14px !important;
}

.message.user,
.message.assistant {
  grid-template-columns: 36px minmax(0, 1fr) !important;
}

.message .avatar {
  width: 36px;
  height: 36px;
}

.message .bubble {
  min-width: 0;
}

.composer {
  padding: 12px var(--chat-side-pad) 24px !important;
}

.input-wrap,
.composer.expanded .input-wrap,
.attachments {
  width: min(var(--chat-measure), 100%) !important;
  max-width: min(var(--chat-measure), calc(100% - 2px)) !important;
  margin-inline: auto !important;
  box-sizing: border-box;
}

.input-wrap {
  border-radius: 22px;
  padding: 12px;
}

.input-wrap textarea,
.input-wrap .composer-input {
  font-size: 15px;
  line-height: 1.65;
}

@media (min-width: 1440px) {
  .chat-shell {
    --chat-measure: min(1240px, calc(100vw - 380px));
  }
}

@media (max-width: 1120px) {
  .chat-shell {
    --chat-measure: min(100%, calc(100vw - 40px));
    --chat-side-pad: clamp(16px, 4vw, 28px);
  }
}

@media (max-width: 860px) {
  .chat-shell {
    --chat-measure: 100%;
    --chat-side-pad: 14px;
  }

  .messages {
    padding: 22px var(--chat-side-pad) 22px !important;
  }

  .composer {
    padding: 10px var(--chat-side-pad) 14px !important;
  }

  .message,
  .message.user,
  .message.assistant,
  .message.notice,
  .input-wrap,
  .composer.expanded .input-wrap,
  .attachments {
    width: 100% !important;
    max-width: 100% !important;
  }

  .message.user,
  .message.assistant {
    grid-template-columns: 32px minmax(0, 1fr) !important;
  }

  .message .avatar {
    width: 32px;
    height: 32px;
  }
}

/* Layout stability pass: keep menus above rails, center chat content, and make uploaded brand assets fit. */
.mark img,
.empty-mark img,
.brand-mark,
[data-brand-logo] {
  object-fit: contain;
  object-position: center;
}

.mark,
.empty-mark,
.brand-mark {
  background: color-mix(in srgb, var(--surface) 88%, white 12%);
}

.model-menu {
  z-index: 5000 !important;
  overscroll-behavior: contain;
}

.chat-shell {
  --chat-measure: min(1120px, 100%);
  --chat-side-pad: clamp(20px, 4.4vw, 64px);
}

.messages {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.message,
.message.user,
.message.assistant,
.message.notice,
.input-wrap,
.composer.expanded .input-wrap,
.attachments {
  width: min(var(--chat-measure), 100%) !important;
  max-width: min(var(--chat-measure), 100%) !important;
}

.message .bubble {
  overflow-wrap: anywhere;
}

@media (max-width: 1120px) {
  .chat-shell {
    --chat-measure: 100%;
    --chat-side-pad: clamp(16px, 4vw, 30px);
  }
}

@media (max-width: 860px) {
  .chat-shell {
    --chat-side-pad: 14px;
  }
}

/* Final theme comfort pass: keep sand first, soften aurora/mono, and tint uploaded logos per theme. */
:root,
html[data-theme="sand"] {
  --brand-logo-filter: none;
  --brand-logo-opacity: 1;
  --brand-logo-bg: #fff8e8;
  --brand-logo-border: rgba(225, 210, 180, 0.9);
  --brand-logo-shadow: 0 14px 34px rgba(111, 78, 50, 0.14);
}

html[data-theme="aurora"] {
  --page: #0c1016;
  --page-2: #141a23;
  --surface: rgba(20, 26, 35, 0.96);
  --surface-2: rgba(27, 34, 44, 0.94);
  --surface-3: rgba(35, 43, 54, 0.94);
  --surface-4: rgba(45, 55, 68, 0.9);
  --ink: #edf3f7;
  --muted: #b8c3cc;
  --muted-2: #8f9ba6;
  --line: rgba(216, 225, 232, 0.12);
  --line-2: rgba(216, 225, 232, 0.2);
  --teal: #d7b56e;
  --teal-soft: rgba(215, 181, 110, 0.12);
  --clay: #89c6d8;
  --clay-soft: rgba(137, 198, 216, 0.12);
  --blue: #9fb4cf;
  --bubble: rgba(22, 28, 37, 0.98);
  --bubble-user: rgba(47, 42, 32, 0.96);
  --chat-bg: #10151d;
  --composer-bg: rgba(22, 28, 37, 0.98);
  --composer-border: rgba(216, 225, 232, 0.14);
  --brand-logo-filter: saturate(0.78) sepia(0.18) hue-rotate(172deg) brightness(0.9) contrast(0.96);
  --brand-logo-opacity: 0.94;
  --brand-logo-bg: rgba(28, 33, 40, 0.92);
  --brand-logo-border: rgba(215, 181, 110, 0.24);
  --brand-logo-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

html[data-theme="mono"] {
  --page: #f7f7f5;
  --page-2: #ececea;
  --surface: rgba(255, 255, 253, 0.96);
  --surface-2: rgba(244, 244, 241, 0.94);
  --surface-3: #e9e9e5;
  --surface-4: #d8d8d2;
  --ink: #20201e;
  --muted: #62625c;
  --muted-2: #85857d;
  --line: rgba(32, 32, 30, 0.12);
  --line-2: rgba(32, 32, 30, 0.2);
  --teal: #4a4a44;
  --teal-soft: rgba(32, 32, 30, 0.06);
  --clay: #5a5a52;
  --clay-soft: rgba(32, 32, 30, 0.055);
  --blue: #555b66;
  --bubble: #fffffd;
  --bubble-user: #eeeeea;
  --input-bg: #fffffd;
  --brand-logo-filter: grayscale(0.82) sepia(0.04) saturate(0.72) brightness(0.96) contrast(1.04);
  --brand-logo-opacity: 0.96;
  --brand-logo-bg: #f3f3ef;
  --brand-logo-border: rgba(32, 32, 30, 0.12);
  --brand-logo-shadow: 0 12px 30px rgba(32, 32, 30, 0.1);
}

html[data-theme="aurora"] body {
  background:
    radial-gradient(circle at 18% -10%, rgba(215, 181, 110, 0.07), transparent 28rem),
    radial-gradient(circle at 88% 4%, rgba(137, 198, 216, 0.06), transparent 25rem),
    linear-gradient(135deg, var(--page), var(--page-2));
}

html[data-theme="mono"] body {
  background:
    radial-gradient(circle at 12% -8%, rgba(255, 255, 255, 0.68), transparent 26rem),
    linear-gradient(180deg, var(--page), var(--page-2));
}

.mark,
.empty-mark,
.brand-mark {
  background: var(--brand-logo-bg) !important;
  border-color: var(--brand-logo-border) !important;
  box-shadow: var(--brand-logo-shadow) !important;
}

.mark img,
.empty-mark img,
.brand-mark,
[data-brand-logo] {
  filter: var(--brand-logo-filter);
  opacity: var(--brand-logo-opacity);
  transition: filter 0.32s ease, opacity 0.32s ease, background-color 0.32s ease, border-color 0.32s ease;
}

html[data-theme="aurora"] .sidebar,
html[data-theme="aurora"] .chat-shell,
html[data-theme="aurora"] .chat-header,
html[data-theme="aurora"] .composer,
html[data-theme="aurora"] .messages {
  background: var(--chat-bg) !important;
}

html[data-theme="aurora"] .category-card,
html[data-theme="aurora"] .archive-folder,
html[data-theme="aurora"] .prompt-card,
html[data-theme="aurora"] .history-row,
html[data-theme="aurora"] .profile-section,
html[data-theme="aurora"] .profile-grid > div,
html[data-theme="aurora"] .admin-section {
  background: rgba(19, 25, 34, 0.82) !important;
  border-color: rgba(216, 225, 232, 0.1) !important;
  box-shadow: none !important;
}

html[data-theme="aurora"] .category-card[open],
html[data-theme="aurora"] .archive-folder[open] {
  background: rgba(24, 31, 41, 0.9) !important;
  border-color: rgba(215, 181, 110, 0.18) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
}

html[data-theme="aurora"] .prompt-card:hover,
html[data-theme="aurora"] .history-row:hover {
  background: rgba(30, 37, 48, 0.84) !important;
  border-color: rgba(137, 198, 216, 0.2) !important;
  transform: translateY(-1px);
}

html[data-theme="aurora"] .history-row.active {
  background: rgba(45, 40, 30, 0.68) !important;
  border-color: rgba(215, 181, 110, 0.25) !important;
  outline: none !important;
}

html[data-theme="aurora"] .category-card em,
html[data-theme="aurora"] .archive-folder summary em,
html[data-theme="aurora"] .prompt-thumb {
  background: rgba(215, 181, 110, 0.1) !important;
  color: #dec486 !important;
  border-color: rgba(215, 181, 110, 0.18) !important;
}

html[data-theme="aurora"] .prompt-send,
html[data-theme="aurora"] .theme-mini button.active,
html[data-theme="aurora"] .theme-option.active {
  background: rgba(215, 181, 110, 0.18) !important;
  color: #f3e2b9 !important;
  border-color: rgba(215, 181, 110, 0.34) !important;
  box-shadow: none !important;
}

html[data-theme="mono"] .sidebar,
html[data-theme="mono"] .chat-shell,
html[data-theme="mono"] .chat-header,
html[data-theme="mono"] .composer,
html[data-theme="mono"] .messages {
  background: #f7f7f5 !important;
}

html[data-theme="mono"] .category-card,
html[data-theme="mono"] .archive-folder,
html[data-theme="mono"] .prompt-card,
html[data-theme="mono"] .history-row,
html[data-theme="mono"] .profile-section,
html[data-theme="mono"] .profile-grid > div,
html[data-theme="mono"] .admin-section {
  background: rgba(255, 255, 253, 0.82) !important;
  border-color: rgba(32, 32, 30, 0.1) !important;
  box-shadow: none !important;
}

html[data-theme="mono"] .category-card[open],
html[data-theme="mono"] .archive-folder[open] {
  background: rgba(244, 244, 241, 0.92) !important;
  border-color: rgba(32, 32, 30, 0.14) !important;
}

html[data-theme="mono"] .prompt-card:hover,
html[data-theme="mono"] .history-row:hover {
  background: rgba(238, 238, 234, 0.9) !important;
  border-color: rgba(32, 32, 30, 0.16) !important;
}

html[data-theme="mono"] .history-row.active,
html[data-theme="mono"] .theme-option.active,
html[data-theme="mono"] .theme-mini button.active {
  background: rgba(32, 32, 30, 0.08) !important;
  color: var(--ink) !important;
  border-color: rgba(32, 32, 30, 0.18) !important;
  box-shadow: none !important;
}

html[data-theme="mono"] .category-card em,
html[data-theme="mono"] .archive-folder summary em,
html[data-theme="mono"] .prompt-thumb {
  background: rgba(32, 32, 30, 0.055) !important;
  color: #4d4d47 !important;
  border-color: rgba(32, 32, 30, 0.1) !important;
}

/* Copy controls for GPT-style message, code, and table actions. */
.message-copy-scope {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.message-actions {
  min-height: 28px;
  display: flex;
  justify-content: flex-start;
}

.message.user .message-actions {
  justify-content: flex-end;
}

.copy-button {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 86%, white);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--ink) 5%, transparent);
}

.copy-button:hover,
.copy-button.copied {
  border-color: color-mix(in srgb, var(--teal) 56%, var(--line));
  background: color-mix(in srgb, var(--teal-soft) 72%, white);
  color: var(--teal);
  transform: translateY(-1px);
}

.export-menu {
  position: fixed;
  z-index: 90;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 94%, white);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--ink) 18%, transparent);
}

.export-menu strong {
  font-size: 13px;
}

.export-menu span {
  color: var(--muted);
  font-size: 12px;
}

.export-menu button {
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, white);
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  padding: 0 10px;
}

.export-menu button:hover {
  border-color: color-mix(in srgb, var(--teal) 52%, var(--line));
  background: color-mix(in srgb, var(--teal-soft) 62%, white);
  color: var(--teal);
}

.export-menu button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.copyable-block {
  min-width: 0;
  margin: 1.1em 0;
  border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
  border-radius: 16px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) 82%, var(--surface-2));
}

.copyable-bar {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px 5px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--surface-2) 84%, var(--surface));
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.copyable-block pre,
.copyable-block table {
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}

.copyable-code pre {
  box-shadow: none !important;
}

.copyable-table {
  overflow-x: auto;
}

/* Auth entrance: first screen is registration with a living product backdrop. */
.auth-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 52px);
  overflow: auto;
  background:
    linear-gradient(135deg, rgba(247, 250, 255, 0.96), rgba(230, 242, 245, 0.94) 48%, rgba(255, 252, 243, 0.96)),
    var(--page);
}


.auth-panel {
  min-width: 0;
}


.auth-panel {
  display: grid;
  align-items: center;
}

.auth-card {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(28px, 4vw, 42px);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 30px 80px rgba(24, 38, 58, 0.16);
  backdrop-filter: blur(18px);
}

.auth-card .mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
}

.auth-card h1 {
  margin: 20px 0 6px;
  font-size: 31px;
  line-height: 1.14;
}

.auth-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.auth-card label {
  margin-bottom: 13px;
}

.auth-card input {
  min-height: 46px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.auth-card .primary,
.auth-card .ghost {
  min-height: 46px;
  border-radius: 8px;
}

.auth-card .primary + .ghost {
  margin-top: 10px;
}

@keyframes authBackdropDrift {
  from {
    transform: translate3d(-2%, -1%, 0) scale(1);
  }
  to {
    transform: translate3d(2%, 1%, 0) scale(1.04);
  }
}

@keyframes authWave {
  0%, 100% {
    transform: translate3d(-3%, 0, 0) rotate(-7deg);
  }
  50% {
    transform: translate3d(3%, 18px, 0) rotate(-4deg);
  }
}

@keyframes authCurrent {
  to {
    transform: rotate(360deg);
  }
}

@keyframes authSpark {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.5;
  }
  50% {
    transform: translate3d(34px, -26px, 0) scale(1.55);
    opacity: 0.95;
  }
}

@keyframes authOrbitTurn {
  to {
    transform: rotate(360deg);
  }
}


@media (max-width: 560px) {
  .auth-shell {
    padding: 14px;
  }

  

  .auth-card {
    padding: 24px 20px;
    border-radius: 18px;
  }
}


/* ============================================================
   2026-06 主题美学重构(最终权威层)
   本层是三套主题唯一的取色来源,统一收敛此前各补丁层留下的
   硬编码颜色与 !important 覆盖。改配色只改下方 token,不要在
   组件规则里再写死颜色。
   - sand   暖砂:奶油纸面 + 陶土橙 + 鼠尾草绿
   - aurora 极光:深蓝夜空 + 薄荷绿 + 冰蓝
   - mono   极简:中性纸白 + 纯黑墨水
   ============================================================ */

:root,
html[data-theme="sand"] {
  color-scheme: light;
  --page: #f6f2e9;
  --page-2: #efe9db;
  --surface: #fdfbf5;
  --surface-2: #f5efe3;
  --surface-3: #ebe3d2;
  --surface-4: #ddd1bb;
  --ink: #2b2419;
  --muted: #6e6354;
  --muted-2: #9a8d79;
  --line: rgba(90, 73, 51, 0.14);
  --line-2: rgba(90, 73, 51, 0.26);
  --teal: #bc5b3d;
  --teal-soft: rgba(188, 91, 61, 0.1);
  --clay: #4d7a6c;
  --clay-soft: rgba(77, 122, 108, 0.11);
  --blue: #5f7193;
  --danger: #b93a2b;
  --warning: #9a6c12;
  --shadow: 0 16px 44px rgba(90, 73, 51, 0.12);
  --panel-alpha: 0.96;
  --accent-ink: #fff6ef;
  --bubble: #fdfbf5;
  --bubble-user: #f2e8d5;
  --bubble-user-ink: #2b2419;
  --input-bg: #fffdf8;
  --chat-bg: #f9f5eb;
  --chat-bg-soft: #f9f5eb;
  --composer-bg: #fdfbf5;
  --composer-border: rgba(90, 73, 51, 0.18);
  --sidebar-bg: #f0eadc;
  --rail-card: #faf6ec;
  --rail-card-open: #f5efe1;
  --rail-card-hover: #f2ebdc;
  --rail-card-active: #f3e8d3;
  --code-bg: #f0e9d8;
  --code-ink: #463b2b;
  --table-bg: #fdfbf5;
  --table-head: #f1e9d7;
  --brand-logo-filter: none;
  --brand-logo-opacity: 1;
  --brand-logo-bg: #fbf3e2;
  --brand-logo-border: rgba(188, 91, 61, 0.22);
  --brand-logo-shadow: 0 12px 30px rgba(90, 73, 51, 0.12);
}

html[data-theme="aurora"] {
  color-scheme: dark;
  --page: #090c12;
  --page-2: #0d1118;
  --surface: #10141d;
  --surface-2: #151b26;
  --surface-3: #1c2431;
  --surface-4: #26303f;
  --ink: #e9eef6;
  --muted: #95a3b7;
  --muted-2: #64748b;
  --line: rgba(158, 184, 219, 0.13);
  --line-2: rgba(158, 184, 219, 0.23);
  --teal: #3edc97;
  --teal-soft: rgba(62, 220, 151, 0.12);
  --clay: #7cc3ea;
  --clay-soft: rgba(124, 195, 234, 0.12);
  --blue: #8fa6e6;
  --danger: #f2796b;
  --warning: #e5ba5f;
  --shadow: 0 22px 64px rgba(0, 0, 0, 0.5);
  --panel-alpha: 0.97;
  --accent-ink: #052b1c;
  --bubble: #131924;
  --bubble-user: #14271f;
  --bubble-user-ink: #e7f4ec;
  --input-bg: #11161f;
  --chat-bg: #0b0f16;
  --chat-bg-soft: #0b0f16;
  --composer-bg: #121823;
  --composer-border: rgba(158, 184, 219, 0.18);
  --sidebar-bg: #0c1017;
  --rail-card: #131924;
  --rail-card-open: #18202c;
  --rail-card-hover: #1a2330;
  --rail-card-active: #15271e;
  --code-bg: #0a0e15;
  --code-ink: #dbe7f2;
  --table-bg: #11161f;
  --table-head: #1a2230;
  --brand-logo-filter: saturate(0.85) brightness(0.96);
  --brand-logo-opacity: 0.95;
  --brand-logo-bg: #161c26;
  --brand-logo-border: rgba(62, 220, 151, 0.2);
  --brand-logo-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
}

html[data-theme="mono"] {
  color-scheme: light;
  --page: #fafafa;
  --page-2: #f0f0ef;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --surface-3: #ebebea;
  --surface-4: #dcdcdb;
  --ink: #151515;
  --muted: #585856;
  --muted-2: #8b8b89;
  --line: rgba(0, 0, 0, 0.1);
  --line-2: rgba(0, 0, 0, 0.2);
  --teal: #181818;
  --teal-soft: rgba(0, 0, 0, 0.05);
  --clay: #3c3c3c;
  --clay-soft: rgba(0, 0, 0, 0.045);
  --blue: #44464a;
  --danger: #ad271f;
  --warning: #735600;
  --shadow: 0 14px 38px rgba(0, 0, 0, 0.08);
  --panel-alpha: 0.98;
  --accent-ink: #fafafa;
  --bubble: #ffffff;
  --bubble-user: #151515;
  --bubble-user-ink: #fafafa;
  --input-bg: #ffffff;
  --chat-bg: #fcfcfb;
  --chat-bg-soft: #fcfcfb;
  --composer-bg: #ffffff;
  --composer-border: rgba(0, 0, 0, 0.16);
  --sidebar-bg: #f3f3f2;
  --rail-card: #fcfcfb;
  --rail-card-open: #f4f4f3;
  --rail-card-hover: #f0f0ef;
  --rail-card-active: #ebebea;
  --code-bg: #f1f1f0;
  --code-ink: #222222;
  --table-bg: #ffffff;
  --table-head: #f3f3f2;
  --brand-logo-filter: grayscale(0.88) contrast(1.04);
  --brand-logo-opacity: 0.96;
  --brand-logo-bg: #f4f4f3;
  --brand-logo-border: rgba(0, 0, 0, 0.12);
  --brand-logo-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
}

/* ---------- 画布与外壳 ---------- */
body,
html[data-theme] body {
  background:
    radial-gradient(120% 70% at 50% -20%, color-mix(in srgb, var(--teal) 6%, transparent), transparent 60%),
    linear-gradient(180deg, var(--page), var(--page-2));
  color: var(--ink);
}

.app-shell {
  background: var(--page);
}

::selection {
  background: color-mix(in srgb, var(--teal) 26%, transparent);
}

* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ink) 24%, transparent) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--ink) 32%, transparent);
  border: 3px solid transparent;
  background-clip: padding-box;
}

/* ---------- 控件基线 ---------- */
html[data-theme] .primary,
html[data-theme] .send-button {
  background: var(--teal);
  border-color: color-mix(in srgb, var(--teal) 82%, var(--ink) 10%);
  color: var(--accent-ink);
  box-shadow: none;
}

html[data-theme] .primary:hover,
html[data-theme] .send-button:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--teal) 90%, var(--ink) 10%);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--teal) 24%, transparent);
}

html[data-theme] .primary:active,
html[data-theme] .send-button:active {
  transform: translateY(0);
  box-shadow: none;
}

.ghost,
.icon-button,
.icon-tool,
.expand-composer,
.file-button {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

.ghost:hover,
.icon-button:hover,
.icon-tool:hover,
.expand-composer:hover,
.file-button:hover {
  background: var(--surface-3);
  border-color: var(--line-2);
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--teal) 55%, transparent);
  outline-offset: 2px;
}

html[data-theme] input,
html[data-theme] textarea,
html[data-theme] select {
  background: var(--input-bg) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

html[data-theme] input:focus,
html[data-theme] textarea:focus,
html[data-theme] select:focus {
  border-color: color-mix(in srgb, var(--teal) 55%, var(--line)) !important;
  box-shadow: 0 0 0 3px var(--teal-soft) !important;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

.error {
  color: var(--danger);
}

html[data-theme] .toast {
  background: var(--ink);
  color: var(--page);
  border: 0;
  box-shadow: var(--shadow);
}

/* ---------- 左右栏与导航 ---------- */
html[data-theme] .sidebar,
html[data-theme] .admin-sidebar {
  background: var(--sidebar-bg) !important;
  border-color: var(--line) !important;
}

html[data-theme] .history-panel {
  background: transparent;
}

html[data-theme] .category-card,
html[data-theme] .archive-folder,
html[data-theme] .prompt-card,
html[data-theme] .history-row,
html[data-theme] .profile-section,
html[data-theme] .profile-grid > div,
html[data-theme] .admin-section {
  background: var(--rail-card) !important;
  border-color: var(--line) !important;
  color: var(--ink);
  box-shadow: none !important;
}

html[data-theme] .category-card[open],
html[data-theme] .archive-folder[open] {
  background: var(--rail-card-open) !important;
  border-color: color-mix(in srgb, var(--teal) 22%, var(--line)) !important;
  box-shadow: none !important;
}

html[data-theme] .prompt-card:hover,
html[data-theme] .history-row:hover {
  background: var(--rail-card-hover) !important;
  border-color: var(--line-2) !important;
  transform: translateY(-1px);
}

html[data-theme] .history-row.active {
  background: var(--rail-card-active) !important;
  border-color: color-mix(in srgb, var(--teal) 36%, var(--line)) !important;
  outline: none !important;
}

html[data-theme] .category-card em,
html[data-theme] .archive-folder summary em {
  background: var(--teal-soft) !important;
  color: color-mix(in srgb, var(--teal) 78%, var(--ink)) !important;
  border-color: color-mix(in srgb, var(--teal) 24%, transparent) !important;
}

html[data-theme] .prompt-thumb {
  background: color-mix(in srgb, var(--teal-soft) 70%, var(--surface)) !important;
  color: color-mix(in srgb, var(--teal) 80%, var(--ink)) !important;
  border-color: color-mix(in srgb, var(--teal) 26%, var(--line)) !important;
}

html[data-theme] .prompt-send {
  background: var(--teal) !important;
  color: var(--accent-ink) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-theme] .prompt-send:hover {
  background: color-mix(in srgb, var(--teal) 88%, var(--ink) 12%) !important;
}

html[data-theme] .theme-mini button.active {
  background: var(--ink) !important;
  color: var(--page) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-theme] .theme-option.active {
  background: var(--surface-2) !important;
  border-color: color-mix(in srgb, var(--teal) 45%, var(--line-2)) !important;
  box-shadow: 0 0 0 3px var(--teal-soft) !important;
  color: var(--ink) !important;
}

/* ---------- 聊天区 ---------- */
html[data-theme] .chat-shell,
html[data-theme] .chat-header,
html[data-theme] .composer,
html[data-theme] .messages {
  background: var(--chat-bg) !important;
  border-color: var(--line);
}

html[data-theme] .input-wrap {
  background: var(--composer-bg) !important;
  border-color: var(--composer-border) !important;
  box-shadow: 0 14px 38px color-mix(in srgb, var(--ink) 7%, transparent);
}

html[data-theme] .bubble,
html[data-theme] .message.assistant .bubble {
  background: var(--bubble) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
  box-shadow: 0 8px 26px color-mix(in srgb, var(--ink) 5%, transparent);
}

html[data-theme] .message.user .bubble {
  background: var(--bubble-user) !important;
  color: var(--bubble-user-ink) !important;
  border-color: color-mix(in srgb, var(--teal) 22%, var(--line)) !important;
}

html[data-theme="mono"] .message.user .bubble {
  border-color: var(--bubble-user) !important;
}

html[data-theme] .avatar {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme] .bubble pre,
html[data-theme] .bubble code {
  background: var(--code-bg);
  color: var(--code-ink);
}

html[data-theme] .bubble table {
  background: var(--table-bg) !important;
  color: var(--ink) !important;
}

html[data-theme] .bubble th,
html[data-theme] .bubble td {
  background: transparent !important;
  color: var(--ink) !important;
  border-color: var(--line-2) !important;
}

html[data-theme] .bubble th {
  background: var(--table-head) !important;
  color: var(--ink) !important;
}

/* ---------- 品牌与主题选择 ---------- */
.mark,
.empty-mark,
.brand-mark {
  background: var(--brand-logo-bg) !important;
  border-color: var(--brand-logo-border) !important;
  box-shadow: var(--brand-logo-shadow) !important;
}

.theme-swatch.sand {
  background: linear-gradient(135deg, #f6f2e9 0 45%, #bc5b3d 45% 72%, #4d7a6c 72%);
}

.theme-swatch.aurora {
  background: linear-gradient(135deg, #090c12 0 45%, #3edc97 45% 72%, #7cc3ea 72%);
}

.theme-swatch.mono {
  background: linear-gradient(135deg, #fafafa 0 48%, #151515 48% 72%, #dcdcdb 72%);
}

/* ---------- 登录页:背景与卡片全部跟随主题 ---------- */
.auth-shell {
  background:
    radial-gradient(90% 60% at 72% -12%, color-mix(in srgb, var(--clay) 9%, transparent), transparent 60%),
    radial-gradient(80% 60% at 8% 112%, color-mix(in srgb, var(--teal) 8%, transparent), transparent 55%),
    linear-gradient(180deg, var(--page), var(--page-2));
}


.auth-card {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.auth-card input {
  background: var(--input-bg);
}

/* ============================================================
   2026-06-11 苹果质感层(毛玻璃 + 大圆角 + 新思考动画)
   位于最终权威层之后,只负责两件事:
   1) 玻璃材质与圆角 —— 颜色仍然全部来自上方 token,本层只
      引入 --glass-* 材质变量,不新增任何硬编码主题色;
   2) 深度思考等待动画(.thinking-shell),与 app.js 的
      waitingMarkup/updateThinkingShell 配套。
   ============================================================ */

:root,
html[data-theme="sand"] {
  --glass: rgba(253, 251, 245, 0.66);
  --glass-strong: rgba(253, 251, 245, 0.84);
  --glass-edge: rgba(255, 255, 255, 0.6);
  --dim: rgba(43, 36, 25, 0.32);
}

html[data-theme="aurora"] {
  --glass: rgba(16, 20, 29, 0.56);
  --glass-strong: rgba(16, 20, 29, 0.82);
  --glass-edge: rgba(160, 190, 230, 0.14);
  --dim: rgba(4, 6, 10, 0.55);
}

html[data-theme="mono"] {
  --glass: rgba(255, 255, 255, 0.6);
  --glass-strong: rgba(255, 255, 255, 0.85);
  --glass-edge: rgba(255, 255, 255, 0.72);
  --dim: rgba(21, 21, 21, 0.3);
}

/* ---------- 画布:柔和环境光,让玻璃有内容可透 ---------- */
html[data-theme] body {
  background:
    radial-gradient(46% 38% at 10% -4%, color-mix(in srgb, var(--teal) 9%, transparent), transparent 70%),
    radial-gradient(52% 42% at 92% 6%, color-mix(in srgb, var(--clay) 8%, transparent), transparent 70%),
    radial-gradient(58% 46% at 50% 110%, color-mix(in srgb, var(--blue) 7%, transparent), transparent 72%),
    linear-gradient(180deg, var(--page), var(--page-2));
  background-attachment: fixed;
}

html[data-theme] .app-shell {
  background: transparent !important;
}

/* ---------- 三栏:玻璃侧栏 + 通透聊天区 ---------- */
html[data-theme] .sidebar,
html[data-theme] .admin-sidebar {
  background: color-mix(in srgb, var(--sidebar-bg) 72%, transparent) !important;
  -webkit-backdrop-filter: blur(28px) saturate(1.45);
  backdrop-filter: blur(28px) saturate(1.45);
}

html[data-theme] .history-panel {
  background: color-mix(in srgb, var(--sidebar-bg) 52%, transparent) !important;
  -webkit-backdrop-filter: blur(28px) saturate(1.45);
  backdrop-filter: blur(28px) saturate(1.45);
}

html[data-theme] .chat-shell,
html[data-theme] .messages,
html[data-theme] .composer {
  background: transparent !important;
}

html[data-theme] .chat-header {
  background: color-mix(in srgb, var(--chat-bg) 58%, transparent) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
}

/* ---------- 气泡:不对称大圆角 ---------- */
html[data-theme] .bubble,
html[data-theme] .message.assistant .bubble {
  border-radius: 20px 20px 20px 8px;
}

html[data-theme] .message.user .bubble {
  border-radius: 20px 20px 8px 20px;
}

html[data-theme] .message.notice .notice-card {
  border-radius: 16px;
}

/* 等待中的消息:卸掉气泡外壳,让思考卡片独立呈现 */
html[data-theme] .message.waiting .bubble {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* ---------- 输入区:玻璃胶囊 ---------- */
html[data-theme] .input-wrap {
  border-radius: 26px !important;
  background: color-mix(in srgb, var(--composer-bg) 76%, transparent) !important;
  border: 1px solid var(--composer-border) !important;
  -webkit-backdrop-filter: blur(30px) saturate(1.5);
  backdrop-filter: blur(30px) saturate(1.5);
  box-shadow:
    0 18px 48px color-mix(in srgb, var(--ink) 9%, transparent),
    inset 0 0 0 0.5px var(--glass-edge) !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

html[data-theme] .input-wrap:focus-within {
  border-color: color-mix(in srgb, var(--teal) 45%, var(--line)) !important;
  box-shadow:
    0 18px 48px color-mix(in srgb, var(--ink) 11%, transparent),
    0 0 0 4px var(--teal-soft),
    inset 0 0 0 0.5px var(--glass-edge) !important;
}

html[data-theme] .input-wrap textarea {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* ---------- 控件:胶囊与圆角统一 ---------- */
html[data-theme] .primary,
html[data-theme] .send-button,
html[data-theme] .model-trigger,
html[data-theme] .user-chip,
html[data-theme] .usage-guide-trigger {
  border-radius: 999px;
}

html[data-theme] .ghost,
html[data-theme] .icon-button,
html[data-theme] .icon-tool,
html[data-theme] .expand-composer,
html[data-theme] .file-button {
  border-radius: 12px;
}

html[data-theme] .category-card,
html[data-theme] .category-card summary,
html[data-theme] .archive-folder,
html[data-theme] .prompt-card,
html[data-theme] .history-row {
  border-radius: 14px;
}

/* ---------- 浮层:重模糊玻璃面板 ---------- */
html[data-theme] .dialog-overlay,
html[data-theme] .profile-overlay {
  background: var(--dim);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  backdrop-filter: blur(12px) saturate(1.15);
}

html[data-theme] .credit-dialog,
html[data-theme] .prompt-submit-dialog,
html[data-theme] .usage-guide-dialog,
html[data-theme] .avatar-crop-dialog,
html[data-theme] .name-dialog {
  border-radius: 26px;
  border: 1px solid var(--line);
  background: var(--glass-strong) !important;
  -webkit-backdrop-filter: blur(40px) saturate(1.6);
  backdrop-filter: blur(40px) saturate(1.6);
  box-shadow:
    0 32px 80px rgba(8, 11, 18, 0.3),
    inset 0 0 0 0.5px var(--glass-edge);
}

html[data-theme] .profile-panel {
  border-radius: 24px 0 0 24px;
  border-left: 1px solid var(--line);
  background: var(--glass-strong) !important;
  -webkit-backdrop-filter: blur(40px) saturate(1.6);
  backdrop-filter: blur(40px) saturate(1.6);
  box-shadow: -28px 0 80px rgba(8, 11, 18, 0.26);
}

html[data-theme] .model-menu {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--glass-strong) !important;
  -webkit-backdrop-filter: blur(32px) saturate(1.5);
  backdrop-filter: blur(32px) saturate(1.5);
  box-shadow:
    0 24px 60px rgba(8, 11, 18, 0.22),
    inset 0 0 0 0.5px var(--glass-edge);
  overflow: hidden;
}

html[data-theme] .toast {
  border-radius: 999px;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

/* ---------- 深度思考卡片 ---------- */
.thinking-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(640px, 100%);
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  box-shadow:
    0 14px 40px color-mix(in srgb, var(--ink) 8%, transparent),
    inset 0 0 0 0.5px var(--glass-edge);
}

.thinking-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
}

/* 三点波浪指示器（Claude 风格） */
.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 22px;
}

.thinking-dots i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  opacity: 0.4;
  animation: thinkDot 1.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 0.18s;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 0.36s;
}

.thinking-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.thinking-elapsed {
  margin-left: auto;
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.thinking-stream {
  display: none;
}

.thinking-shell.has-stream .thinking-stream {
  display: block;
  max-height: 150px;
  overflow-y: auto;
  scrollbar-width: none;
  border-radius: 12px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 28px);
  mask-image: linear-gradient(180deg, transparent 0, #000 28px);
}

.thinking-stream::-webkit-scrollbar {
  display: none;
}

.thinking-stream pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
}

.thinking-foot {
  font-size: 12px;
  color: var(--muted-2);
}

/* 普通"正在回答"三点动画跟随主题色 */
html[data-theme] .typing span {
  background: var(--teal);
}

@keyframes thinkDot {
  0%, 80%, 100% {
    transform: scale(0.7);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes ffSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ffBreathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.88);
    opacity: 0.82;
  }
}

@keyframes ffShimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -20% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .thinking-dots i,
  .thinking-label {
    animation: none !important;
  }
}

/* ---------- 会话标题:只读纯文本(在历史栏里改名) ---------- */
h1.title-input {
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: text;
}

/* ============================================================
   2026-06-11 后台管理质感层
   与前台同一套 token/玻璃材质,服务于重设计后的
   统计概览、价格倍率、模型管理等界面。
   ============================================================ */

html[data-theme] .admin-main {
  background: transparent !important;
}

html[data-theme] .admin-section {
  border-radius: 18px;
  border: 1px solid var(--line);
}

/* ---------- 统计窗口卡 ---------- */
.stats-windows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

html[data-theme] .metric-card.window-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface) !important;
  box-shadow: var(--shadow-sm, 0 16px 44px rgba(15, 23, 42, 0.07));
}

.window-card span {
  font-size: 12px;
  font-weight: 640;
  letter-spacing: 0.06em;
  color: var(--teal);
}

.window-card strong {
  font-size: 20px;
  line-height: 1.2;
  color: var(--ink);
}

.window-card em {
  font-style: normal;
  font-size: 12.5px;
  color: var(--muted);
}

.window-card small {
  font-size: 12px;
  color: var(--muted-2);
}

/* ---------- 统计表 ---------- */
.stats-table th {
  white-space: nowrap;
}

.stats-table td small {
  display: block;
  color: var(--muted-2);
  font-size: 11.5px;
}

.stats-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}

/* ---------- 价格倍率 ---------- */
.pricing-help p {
  margin: 6px 0 0;
  line-height: 1.8;
}

.pricing-list {
  display: grid;
  gap: 14px;
}

.pricing-cost-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.markup-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.markup-label {
  font-size: 13px;
  font-weight: 640;
  color: var(--muted);
}

.markup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

html[data-theme] .markup-chip {
  min-width: 52px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 640;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

html[data-theme] .markup-chip:hover {
  transform: translateY(-1px);
  border-color: var(--line-2);
}

html[data-theme] .markup-chip.active {
  background: var(--teal);
  border-color: transparent;
  color: var(--accent-ink);
}

html[data-theme] .markup-input {
  width: 90px;
  border-radius: 999px !important;
  text-align: center;
}

.pricing-preview {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--teal-soft);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink);
}

.pricing-preview em {
  font-style: normal;
  font-size: 12.5px;
  color: var(--muted);
}

.pricing-row.disabled {
  opacity: 0.62;
}

.pricing-row .pricing-tiers {
  margin-top: 12px;
}

.pricing-row .pricing-tiers summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- 模型卡 ---------- */
.compact-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}

.model-card.disabled {
  opacity: 0.62;
}

.model-base-label {
  grid-column: 1 / -1;
}

.model-toggle-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}

.model-toggle-row .primary {
  margin-left: auto;
}

html[data-theme] .status-pill.off {
  background: var(--surface-3);
  color: var(--muted);
}

/* ---------- 用户搜索 ---------- */
.user-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

html[data-theme] .user-search-wrap .admin-search {
  min-width: 260px;
  border-radius: 999px !important;
}

html[data-theme] .user-search-clear {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.user-search-wrap .status-pill {
  flex: none;
  white-space: nowrap;
}

html[data-theme] .user-search-clear:hover {
  background: var(--surface-4);
  color: var(--ink);
}

.user-empty {
  text-align: center;
  padding: 28px 12px !important;
  color: var(--muted);
}

/* ---------- 通用收尾 ---------- */
html[data-theme] .admin-nav button {
  border-radius: 12px;
}

html[data-theme] .credit-plus {
  color: var(--clay);
}

html[data-theme] .credit-minus {
  color: var(--danger);
}

@media (max-width: 760px) {
  .stats-windows {
    grid-template-columns: repeat(2, 1fr);
  }

  .markup-row {
    align-items: flex-start;
  }
}


/* ============================================================
   登录页 2026-06 重设计:暖砂水光 / 实况轮播 / 分段式登录注册。
   色调跟随默认 sand 主题(奶油底 / 陶土主色 #b96f50 / 深青辅色 #2b6f6a),
   全部使用 authy- 前缀;旧 .authx-* 区块已随 DOM 移除而失效。
   ============================================================ */
#login.authy {
  position: relative;
  min-height: 100vh;
  display: flex;
  background: #f6f1e8;
  color: #241f1a;
}

.authy-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.authy-bg canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.authy-bg-grad {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 85% at 80% 8%, rgba(185, 111, 80, 0.05), transparent 55%),
    radial-gradient(95% 80% at 10% 92%, rgba(43, 111, 106, 0.045), transparent 60%);
}

.authy-stage {
  position: relative;
  z-index: 1;
  width: min(1200px, 100% - 48px);
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 416px;
  gap: clamp(36px, 6vw, 92px);
  align-items: center;
  padding: 56px 0;
}

/* ---------- 左侧叙事 ---------- */
.authy-hero {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.authy-hero > * {
  opacity: 0;
  animation: authy-rise 0.75s cubic-bezier(0.22, 0.8, 0.26, 1) forwards;
}

.authy-hero > *:nth-child(1) { animation-delay: 0.05s; }
.authy-hero > *:nth-child(2) { animation-delay: 0.14s; }
.authy-hero > *:nth-child(3) { animation-delay: 0.23s; }
.authy-hero > *:nth-child(4) { animation-delay: 0.32s; }
.authy-hero > *:nth-child(5) { animation-delay: 0.41s; }

@keyframes authy-rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

.authy-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.authy-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, rgba(185, 111, 80, 0.14), rgba(255, 250, 242, 0.9));
  border: 1px solid rgba(185, 111, 80, 0.3);
  box-shadow: 0 10px 26px -14px rgba(185, 111, 80, 0.55);
}

.authy-brand-mark img {
  width: 28px;
  height: 28px;
}

.authy-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.authy-eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #b96f50;
}

.authy-brand-text strong {
  font-size: 15px;
  font-weight: 600;
  color: #241f1a;
}

.authy-headline {
  margin: 0;
  font-size: clamp(30px, 3.5vw, 46px);
  line-height: 1.24;
  font-weight: 700;
  color: #241f1a;
}

.authy-typed-wrap {
  display: inline-flex;
  align-items: center;
}

#authyTyped {
  background: linear-gradient(95deg, #b96f50 10%, #2b6f6a 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.authy-caret {
  display: inline-block;
  width: 3px;
  height: 0.92em;
  margin-left: 7px;
  border-radius: 2px;
  background: #b96f50;
  animation: authy-blink 1.1s steps(2, start) infinite;
}

@keyframes authy-blink {
  50% { opacity: 0; }
}

.authy-sub {
  margin: 0;
  max-width: 540px;
  font-size: 15px;
  line-height: 1.8;
  color: #62594e;
}

.authy-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.authy-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  color: #62594e;
  border: 1px solid rgba(74, 63, 52, 0.16);
  background: rgba(255, 250, 242, 0.66);
  backdrop-filter: blur(8px);
  transition: border-color 0.35s, transform 0.35s, background 0.35s;
}

.authy-chip i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #b96f50;
  box-shadow: 0 0 7px rgba(185, 111, 80, 0.7);
}

.authy-chip:hover {
  border-color: rgba(185, 111, 80, 0.45);
  background: rgba(255, 250, 242, 0.92);
  transform: translateY(-1px);
}

/* ---------- 工作台实况轮播 ---------- */
.authy-showcase {
  width: min(580px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(74, 63, 52, 0.14);
  background: linear-gradient(160deg, rgba(255, 250, 242, 0.82), rgba(245, 238, 226, 0.88));
  backdrop-filter: blur(16px);
  box-shadow: 0 26px 64px -30px rgba(74, 63, 52, 0.4);
  overflow: hidden;
}

.authy-showcase-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(74, 63, 52, 0.1);
}

.authy-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: #8a7f72;
}

.authy-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b96f50;
  animation: authy-pulse 2.2s ease-out infinite;
}

@keyframes authy-pulse {
  0% { box-shadow: 0 0 0 0 rgba(185, 111, 80, 0.4); }
  70% { box-shadow: 0 0 0 7px rgba(185, 111, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(185, 111, 80, 0); }
}

.authy-dots {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.authy-dots button {
  width: 16px;
  height: 4px;
  padding: 0;
  border: none;
  border-radius: 99px;
  cursor: pointer;
  background: rgba(74, 63, 52, 0.18);
  transition: background 0.35s, width 0.35s;
}

.authy-dots button:hover {
  background: rgba(74, 63, 52, 0.34);
}

.authy-dots button.active {
  width: 30px;
  background: #b96f50;
}

.authy-slides {
  position: relative;
  height: 218px;
}

.authy-slide {
  position: absolute;
  inset: 0;
  padding: 16px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  opacity: 0;
  transform: translateX(28px);
  transition: opacity 0.55s cubic-bezier(0.22, 0.8, 0.26, 1), transform 0.55s cubic-bezier(0.22, 0.8, 0.26, 1);
  pointer-events: none;
}

.authy-slide.active {
  opacity: 1;
  transform: none;
}

.authy-slide header {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: #3a332b;
}

.authy-slide header img {
  width: 18px;
  height: 18px;
  border-radius: 5px;
}

.authy-slide-tag {
  margin-left: auto;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11px;
  color: #a85f43;
  border: 1px solid rgba(185, 111, 80, 0.35);
  background: rgba(185, 111, 80, 0.09);
}

.authy-slide-user {
  margin: 0;
  align-self: flex-end;
  max-width: 88%;
  padding: 8px 13px;
  border-radius: 13px 13px 4px 13px;
  font-size: 13px;
  line-height: 1.6;
  color: #33291f;
  background: #eee2d0;
  border: 1px solid rgba(74, 63, 52, 0.12);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.authy-slide-out {
  position: relative;
  flex: 1;
  min-height: 0;
}

.authy-slide-think {
  position: absolute;
  top: 8px;
  left: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #8a7f72;
  transition: opacity 0.3s;
}

.authy-slide-think span {
  margin-left: 5px;
}

.authy-slide-think i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(185, 111, 80, 0.8);
  animation: authy-think 1.2s ease infinite;
}

.authy-slide-think i:nth-child(2) { animation-delay: 0.15s; }
.authy-slide-think i:nth-child(3) { animation-delay: 0.3s; }

@keyframes authy-think {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.authy-slide-reply {
  margin: 0;
  max-width: 94%;
  padding: 9px 13px;
  border-radius: 13px 13px 13px 4px;
  font-size: 13px;
  line-height: 1.66;
  color: #3a332b;
  background: #fffaf2;
  border: 1px solid rgba(74, 63, 52, 0.12);
  opacity: 0;
  transition: opacity 0.3s;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.authy-slide.replying .authy-slide-think { opacity: 0; }
.authy-slide.replying .authy-slide-reply { opacity: 1; }

.authy-slide-caret {
  display: inline-block;
  width: 2px;
  height: 12px;
  margin-left: 3px;
  vertical-align: -2px;
  background: #b96f50;
  animation: authy-blink 1s steps(2, start) infinite;
}

/* ---------- 右侧登录卡 ---------- */
.authy-panel {
  display: flex;
  justify-content: center;
  min-width: 0;
  opacity: 0;
  animation: authy-rise 0.75s cubic-bezier(0.22, 0.8, 0.26, 1) 0.2s forwards;
}

.authy-card-shell {
  width: 100%;
  border-radius: 22px;
  border: 1px solid rgba(74, 63, 52, 0.15);
  background: linear-gradient(168deg, rgba(255, 250, 242, 0.92), rgba(247, 240, 228, 0.95));
  backdrop-filter: blur(20px);
  box-shadow: 0 36px 80px -38px rgba(74, 63, 52, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  padding: 26px 26px 28px;
}

.authy-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  margin-bottom: 20px;
  border-radius: 12px;
  background: rgba(74, 63, 52, 0.07);
  border: 1px solid rgba(74, 63, 52, 0.1);
}

.authy-tabs::before {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 9px;
  background: #fffaf2;
  border: 1px solid rgba(185, 111, 80, 0.38);
  box-shadow: 0 3px 10px -4px rgba(74, 63, 52, 0.35);
  transition: transform 0.4s cubic-bezier(0.3, 0.9, 0.3, 1.05);
}

.authy-tabs[data-mode='login']::before {
  transform: translateX(100%);
}

.authy-tabs button {
  position: relative;
  z-index: 1;
  padding: 9px 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 9px;
  font-size: 13.5px;
  color: #8a7f72;
  transition: color 0.3s;
}

.authy-tabs button.active {
  color: #241f1a;
  font-weight: 600;
}

.authy-tabs.single {
  display: none;
}

.authy-card {
  display: flex;
  flex-direction: column;
  gap: 13px;
  animation: authy-form 0.45s cubic-bezier(0.25, 0.9, 0.3, 1);
}

@keyframes authy-form {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.authy-card h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  color: #241f1a;
}

.authy-card > p {
  margin: -5px 0 3px;
  font-size: 13px;
  line-height: 1.65;
  color: #8a7f72;
}

.authy-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.authy-field span {
  font-size: 12px;
  letter-spacing: 0.03em;
  color: #62594e;
}

.authy-field input {
  appearance: none;
  width: 100%;
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px solid rgba(74, 63, 52, 0.18);
  background: #fffaf2;
  color: #241f1a;
  font-size: 14px;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

.authy-field input::placeholder {
  color: rgba(98, 89, 78, 0.45);
}

.authy-field input:hover {
  border-color: rgba(74, 63, 52, 0.32);
}

.authy-field input:focus {
  outline: none;
  border-color: rgba(185, 111, 80, 0.6);
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(185, 111, 80, 0.14);
}

.authy-field input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #fffaf2 inset;
  -webkit-text-fill-color: #241f1a;
  caret-color: #241f1a;
  transition: background-color 99999s ease-out;
}

.authy-submit {
  position: relative;
  overflow: hidden;
  margin-top: 5px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 600;
  color: #fff7ef;
  background: linear-gradient(135deg, #c97f5e, #b96f50 55%, #a85f43);
  box-shadow: 0 14px 30px -14px rgba(185, 111, 80, 0.75);
  transition: transform 0.25s, box-shadow 0.25s, filter 0.25s;
}

.authy-submit::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -70%;
  width: 42%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-18deg);
  transition: left 0.65s ease;
}

.authy-submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 18px 36px -14px rgba(185, 111, 80, 0.85);
}

.authy-submit:hover::after {
  left: 125%;
}

.authy-submit:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.authy-card .error {
  min-height: 17px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #b4443d;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .authy-stage {
    grid-template-columns: 1fr;
    width: min(620px, 100% - 40px);
    gap: 34px;
    padding: 44px 0 52px;
  }

  .authy-hero {
    align-items: center;
    text-align: center;
  }

  .authy-sub {
    max-width: 480px;
  }

  .authy-chips {
    justify-content: center;
  }

  .authy-showcase {
    display: none;
  }
}

@media (max-width: 560px) {
  .authy-stage {
    width: min(560px, 100% - 28px);
    padding: 32px 0 40px;
    gap: 24px;
  }

  .authy-chips {
    display: none;
  }

  .authy-headline {
    font-size: 27px;
  }

  .authy-card-shell {
    padding: 20px 18px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .authy-hero > *,
  .authy-panel {
    opacity: 1;
    animation: none;
  }

  .authy-card {
    animation: none;
  }

  .authy-slide {
    transition: none;
  }

  .authy-caret,
  .authy-slide-caret,
  .authy-live i,
  .authy-slide-think i {
    animation: none;
  }
}

/* 登录页输入框脱离主题强制色(html[data-theme] input 带 !important):
   不管用户存了哪套主题,登录卡内永远保持 sand 暖砂输入框。 */
html[data-theme] .authy-field input {
  background: #fffaf2 !important;
  color: #241f1a !important;
  border-color: rgba(74, 63, 52, 0.18) !important;
}

html[data-theme] .authy-field input:hover {
  border-color: rgba(74, 63, 52, 0.32) !important;
}

html[data-theme] .authy-field input:focus {
  border-color: rgba(185, 111, 80, 0.6) !important;
  background: #fffdf8 !important;
  box-shadow: 0 0 0 3px rgba(185, 111, 80, 0.14) !important;
}

/* 登录页可见时,body 跟随暖砂底色,避免其它主题背景在边缘透出 */
body:has(#login.authy:not(.hidden)) {
  background: #f6f1e8;
}

/* ============================================================
   对话区重构 —— 贴近 Claude 网页版的阅读体验
   助手:无边框文档流;用户:右对齐胶囊;代码块:统一深色;
   复制按钮:SVG 图标 + hover 显形。本段位于文件末尾,统一覆盖
   前面散落的旧规则,三套主题一致。
   ============================================================ */
.messages {
  padding: 30px max(20px, 7vw) 44px;
}
.message {
  max-width: 760px;
  margin: 0 auto 24px;
}
/* 用户/助手消息走新版文档流布局;notice(已载入 Skill)保留它原有的胶囊样式 */
.message:not(.notice) {
  display: block;
}
.message:not(.notice) .avatar {
  display: none;
}
.message-copy-scope {
  display: block;
  min-width: 0;
}

/* 助手:无边框纯文本流 */
.message.assistant .bubble {
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 2px 0;
  overflow: visible;
  color: var(--ink);
  line-height: 1.78;
}
.message.assistant .bubble > :first-child { margin-top: 0; }
.message.assistant .bubble > :last-child { margin-bottom: 0; }

/* 用户:右对齐胶囊 */
.message.user .message-copy-scope {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.message.user .bubble {
  width: fit-content;
  max-width: 88%;
  padding: 11px 16px;
  border-radius: 18px 18px 6px 18px;
  background: color-mix(in srgb, var(--teal-soft) 64%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--teal) 16%, var(--line));
  box-shadow: none;
  color: var(--ink);
  line-height: 1.62;
  overflow: visible;
}

/* 行内代码 */
.bubble :not(pre) > code {
  background: color-mix(in srgb, var(--surface-3) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

/* 复制按钮:SVG 图标,默认低调,hover/聚焦显形 */
.message-actions {
  min-height: 0;
  margin-top: 7px;
  opacity: 0;
  transition: opacity 0.16s ease;
}
.message:hover .message-actions,
.message-actions:focus-within {
  opacity: 1;
}
.message.user .message-actions {
  justify-content: flex-end;
}
.copy-button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--muted);
  cursor: pointer;
  box-shadow: none;
  transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.copy-button svg {
  width: 15px;
  height: 15px;
  display: block;
}
.copy-button:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--line) 100%, transparent);
  background: var(--surface-3);
  transform: none;
}
.copy-button.copied {
  color: var(--teal);
  border-color: color-mix(in srgb, var(--teal) 50%, var(--line));
  background: color-mix(in srgb, var(--teal-soft) 60%, var(--surface));
}

/* 代码块:跟随主题的 --code-bg/--code-ink 令牌,任何主题下都保证底色与字色成对、对比度足够 */
.copyable-block {
  margin: 1.05em 0;
  border-radius: 14px;
  overflow: hidden;
}
.copyable-code {
  border: 1px solid color-mix(in srgb, var(--code-ink) 16%, var(--code-bg));
  background: var(--code-bg);
}
.copyable-code .copyable-bar {
  min-height: 38px;
  padding: 6px 8px 6px 14px;
  background: color-mix(in srgb, var(--code-bg) 86%, var(--code-ink));
  border-bottom: 1px solid color-mix(in srgb, var(--code-ink) 14%, var(--code-bg));
  color: color-mix(in srgb, var(--code-ink) 72%, transparent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.copyable-code .copy-button {
  border-color: color-mix(in srgb, var(--code-ink) 22%, var(--code-bg));
  background: transparent;
  color: color-mix(in srgb, var(--code-ink) 70%, transparent);
}
.copyable-code .copy-button:hover {
  color: var(--code-ink);
  background: color-mix(in srgb, var(--code-ink) 12%, var(--code-bg));
  border-color: color-mix(in srgb, var(--code-ink) 34%, var(--code-bg));
}
.copyable-code .copy-button.copied {
  color: var(--teal);
  border-color: color-mix(in srgb, var(--teal) 50%, var(--code-bg));
  background: color-mix(in srgb, var(--teal) 16%, var(--code-bg));
}
.message .bubble .copyable-code pre {
  margin: 0 !important;
  padding: 14px 16px !important;
  background: var(--code-bg) !important;
  color: var(--code-ink) !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.62;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
}
.message .bubble .copyable-code pre code {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  color: inherit !important;
  font-size: inherit;
}

/* 表格块:跟随主题的清爽卡片 */
.copyable-table {
  border: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto;
}
.copyable-table .copyable-bar {
  min-height: 36px;
  padding: 6px 8px 6px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.copyable-table table {
  width: 100%;
  border-collapse: collapse;
}
.copyable-table th,
.copyable-table td {
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 66%, transparent);
  padding: 9px 13px;
  text-align: left;
}
.copyable-table th {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  font-weight: 700;
}
.copyable-table tr:last-child td {
  border-bottom: 0;
}

/* 输入框与消息同宽居中,解决"不居中"与上下错位 */
.composer {
  padding: 14px max(20px, 7vw) 20px;
}
.input-wrap,
.attachments {
  max-width: 760px;
}

/* ===== 2026-06-22 后台用户管理重构:概览表 + 管理抽屉 ===== */
.user-overview-table td {
  vertical-align: middle;
}
.user-overview-table .user-cell-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.user-overview-table .user-cell-name strong {
  font-size: 14px;
}
.user-overview-table td small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.user-row-disabled {
  opacity: 0.55;
}
.user-overview-table .col-manage {
  text-align: right;
  white-space: nowrap;
}
.manage-btn {
  padding-inline: 18px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line-2);
  color: var(--muted);
  background: var(--surface-2);
}
.role-badge.role-super_admin {
  color: var(--teal);
  border-color: color-mix(in srgb, var(--teal) 45%, transparent);
  background: var(--teal-soft);
}
.role-badge.role-prompt_admin {
  color: #b9831f;
  border-color: color-mix(in srgb, #b9831f 40%, transparent);
  background: color-mix(in srgb, #b9831f 12%, transparent);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.status-chip.on {
  color: var(--teal);
  background: var(--teal-soft);
}
.status-chip.off {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
}

/* 抽屉 */
body.drawer-open {
  overflow: hidden;
}
.user-drawer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  justify-content: flex-end;
}
.user-drawer.hidden {
  display: none;
}
.user-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 16, 0.42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: drawerFade 0.18s ease both;
}
.user-drawer-panel {
  position: relative;
  width: min(460px, 100vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--page);
  border-left: 1px solid var(--line-2);
  box-shadow: -24px 0 60px rgba(8, 11, 16, 0.28);
  animation: drawerSlide 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes drawerFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes drawerSlide {
  from { transform: translateX(24px); opacity: 0.4; }
  to { transform: translateX(0); opacity: 1; }
}
.user-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.user-drawer-identity {
  min-width: 0;
}
.drawer-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.drawer-name-row strong {
  font-size: 17px;
}
.user-drawer-identity small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  word-break: break-all;
}
.user-drawer-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.user-drawer-close:hover {
  color: var(--ink);
  background: var(--surface-3);
}
.user-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 20px 24px;
}
.drawer-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.drawer-section:last-child {
  border-bottom: 0;
}
.drawer-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.drawer-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin-bottom: 12px;
}
.drawer-stat-row > div {
  display: flex;
  flex-direction: column;
}
.drawer-stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 1px;
}
.drawer-stat-row strong {
  font-size: 14px;
}
.drawer-credit-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}
.drawer-credit-row input {
  width: 100%;
}
.drawer-field {
  margin-bottom: 12px;
}
.drawer-field:last-child {
  margin-bottom: 0;
}
.drawer-field > label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.drawer-password-view,
.drawer-password-set {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.drawer-password-set {
  grid-template-columns: 1fr auto;
}
.drawer-password-view input,
.drawer-password-set input {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}
.btn.wide,
button.wide {
  width: 100%;
}
.drawer-field .wide {
  margin-top: 2px;
}
.drawer-field select {
  width: 100%;
}
.drawer-field:has(select) {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.drawer-switch {
  margin-bottom: 6px;
}
.danger-zone h3 {
  color: var(--danger);
}
.drawer-note {
  margin: 14px 0 0;
  font-size: 12px;
}

/* 模型排序拖动条 */
.model-drag-list .model-drag-name {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-drag-list .model-drag-meta {
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}
.model-drag-list .drag-item.disabled {
  opacity: 0.55;
}


/* Multimodal attachments */
.composer.drop-active {
  outline: 2px dashed color-mix(in srgb, var(--accent) 72%, white);
  outline-offset: 4px;
  background: color-mix(in srgb, var(--composer-bg) 82%, var(--accent) 18%) !important;
}

.composer.uploading .attachments::after {
  content: '上传中...';
  align-self: center;
  color: var(--muted);
  font-size: 12px;
}

.composer.uploading .input-wrap {
  position: relative;
}

.composer.uploading .input-wrap::after {
  content: '上传中…';
  position: absolute;
  right: 14px;
  bottom: 12px;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

.attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  cursor: pointer;
  user-select: none;
}

.attachment button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.12);
  color: var(--muted);
  cursor: pointer;
  flex: 0 0 auto;
}

.attachment-file-mark {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.08);
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
}

.message-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  max-width: min(520px, 72vw);
}

.message-attachment-thumb {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  padding: 5px;
  min-width: 0;
  cursor: zoom-in;
  display: grid;
  gap: 5px;
  color: var(--text);
  text-align: left;
}

.message-attachment-thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.message-attachment-thumb span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
}

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 10, 18, 0.82);
  cursor: zoom-out;
}

.image-preview-overlay.hidden {
  display: none;
}

.image-preview-overlay figure {
  margin: 0;
  display: grid;
  gap: 10px;
  max-width: min(96vw, 1280px);
  max-height: 94vh;
}

.image-preview-overlay img {
  max-width: 100%;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.42);
}

.image-preview-overlay figcaption {
  color: #fff;
  text-align: center;
  font-size: 13px;
}

.image-mention-menu {
  position: fixed;
  z-index: 70;
  width: min(320px, calc(100vw - 24px));
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
}

.image-mention-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.image-mention-menu button.active,
.image-mention-menu button:hover {
  background: rgba(15, 23, 42, 0.08);
}

.image-mention-menu img {
  width: 34px;
  height: 34px;
  border-radius: 5px;
  object-fit: cover;
  flex: 0 0 auto;
}

/* 内联图片/文件胶囊:嵌在 contenteditable 文字流里(对齐即梦) */
.composer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  max-width: 220px;
  margin: 1px 2px;
  padding: 3px 6px 3px 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 78%, var(--accent) 8%);
  line-height: 1.2;
  user-select: none;
  cursor: grab;
  white-space: nowrap;
}

.composer-chip:active {
  cursor: grabbing;
}

.input-wrap .composer-input.chip-drop-active {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 12px;
}

.composer-chip img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
  flex: 0 0 auto;
  display: block;
}

.composer-chip .composer-chip-file {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.1);
  font-size: 8px;
  font-weight: 700;
  color: var(--muted);
  flex: 0 0 auto;
}

.composer-chip .composer-chip-name {
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.composer-chip .composer-chip-remove {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.14);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
}

.composer-chip .composer-chip-remove:hover {
  background: rgba(15, 23, 42, 0.28);
  color: #fff;
}


.upload-drop-overlay {
  position: fixed;
  inset: 14px;
  z-index: 90;
  pointer-events: none;
  display: grid;
  place-content: center;
  gap: 8px;
  border: 3px dashed color-mix(in srgb, var(--accent) 84%, white);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 62%, var(--accent) 18%);
  box-shadow: inset 0 0 0 9999px rgba(25, 36, 50, 0.16), 0 24px 80px rgba(15, 23, 42, 0.26);
  color: var(--text);
  text-align: center;
  backdrop-filter: blur(3px);
}

.upload-drop-overlay.hidden {
  display: none;
}

.upload-drop-overlay strong {
  font-size: 28px;
  line-height: 1.1;
}

.upload-drop-overlay span {
  color: var(--muted);
  font-size: 14px;
}

body.upload-drop-active .chat-shell,
body.upload-drop-uploading .chat-shell {
  filter: saturate(1.08);
}


/* Admin file-based Skill manager */
/* ===== 文件型 Skill:三栏 IDE(Skill 列表 | 文件树 | 编辑器) ===== */
.skill-ide {
  display: grid;
  grid-template-columns: minmax(180px, 0.65fr) minmax(200px, 0.8fr) minmax(420px, 2.1fr);
  gap: 14px;
  align-items: start;
}

.skill-ide .admin-section {
  min-width: 0;
}

.skill-ide-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.skill-ide-skills {
  display: grid;
  gap: 8px;
}

.skill-ide-skill {
  display: grid;
  gap: 3px;
  text-align: left;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: white;
  cursor: pointer;
}

.skill-ide-skill strong {
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.skill-ide-skill small {
  font-size: 11px;
  color: var(--muted);
}

.skill-ide-skill:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.skill-ide-skill.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, white);
}

.skill-ide-slug {
  margin: 0;
  font-size: 15px;
  word-break: break-all;
}

.skill-ide-desc {
  margin-top: 2px;
  font-size: 11px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skill-file-tree {
  display: grid;
  gap: 4px;
  margin-top: 12px;
}

.skill-file-group {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.skill-file-group-label {
  padding: 4px 4px 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.skill-file-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.skill-file-group .skill-file-row {
  padding-left: 16px;
}

.skill-file-row:hover {
  background: color-mix(in srgb, var(--surface) 70%, var(--line));
}

.skill-file-row.active {
  background: color-mix(in srgb, var(--accent) 14%, white);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.skill-file-icon {
  font-size: 13px;
}

.skill-file-name {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-file-bytes {
  font-size: 10.5px;
  color: var(--muted);
}

.skill-files-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.skill-files-foot button {
  flex: 1 1 auto;
}

.skill-ide-editor code {
  padding: 2px 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface) 84%, var(--line));
}

.skill-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.skill-editor-path {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.skill-editor-path strong {
  font-size: 14px;
  word-break: break-all;
}

.skill-editor-path .muted {
  font-size: 11px;
}

.skill-editor-head-actions {
  display: flex;
  gap: 8px;
}

.skill-file-editor {
  width: 100%;
  min-height: 60vh;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  line-height: 1.6;
  tab-size: 2;
}

.skill-editor-hint {
  margin-top: 10px;
  font-size: 11px;
}

.skill-upload-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 2px 8px 2px 2px;
  background: var(--line);
  border-radius: 999px;
}

.skill-upload-progress-bar {
  height: 4px;
  width: 0%;
  min-width: 2%;
  border-radius: 999px;
  background: var(--teal);
  transition: width 0.2s ease;
  flex: 1;
}

.skill-upload-progress-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.skill-upload-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.skill-upload-row .skill-upload-progress {
  flex: 1;
  min-width: 0;
}

.skill-upload-row .skill-upload-progress-label {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.skill-upload-cancel {
  flex: 0 0 auto;
  padding: 4px 10px;
  font-size: 12px;
}

.tutorial-video-list-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.tutorial-video-thumb {
  width: 56px;
  height: 34px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--teal-soft) 62%, var(--surface));
  border: 1px solid var(--line);
  color: var(--teal);
  font-weight: 800;
}

.tutorial-video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tutorial-video-upload-panel {
  display: grid;
  gap: 10px;
}

.tutorial-video-upload-panel h3 {
  margin: 0;
}

.tutorial-video-upload-panel .skill-upload-progress {
  padding: 4px 10px 4px 4px;
}

.tutorial-video-upload-panel .skill-upload-progress-bar {
  height: 6px;
}

.tutorial-video-upload-panel .skill-upload-progress-label {
  font-size: 12.5px;
}

/* 前台:使用说明弹窗底部的"教学视频"入口按钮 + 视频列表/播放浮层 */
.usage-guide-foot {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.tutorial-video-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--teal) 30%, var(--line));
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.tutorial-video-entry:hover {
  filter: brightness(0.97);
}

.tutorial-video-list-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: min(80vh, 720px);
  overflow-y: auto;
  border: 1px solid color-mix(in srgb, var(--teal) 22%, var(--line));
  border-radius: 28px;
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
  color: var(--ink);
  padding: 22px;
  box-shadow: var(--shadow);
}

.tutorial-video-list-dialog h2 {
  margin: 12px 0 14px;
  font-size: clamp(22px, 3.6vw, 30px);
  letter-spacing: -0.05em;
}

.tutorial-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.tutorial-video-card {
  display: grid;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
  padding: 10px;
  cursor: pointer;
}

.tutorial-video-card:hover {
  border-color: color-mix(in srgb, var(--teal) 40%, var(--line));
}

.tutorial-video-card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: color-mix(in srgb, var(--teal-soft) 62%, var(--surface));
  display: grid;
  place-items: center;
}

.tutorial-video-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tutorial-video-card-placeholder {
  color: var(--teal);
  font-size: 24px;
}

.tutorial-video-card-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  background: rgba(15, 23, 42, 0.18);
}

.tutorial-video-card-title {
  font-weight: 700;
  font-size: 13.5px;
}

.tutorial-video-card-desc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.tutorial-video-empty {
  text-align: center;
  padding: 24px 0;
}

.tutorial-video-player-backdrop {
  position: absolute;
  inset: 0;
}

.tutorial-video-player-shell {
  position: relative;
  width: min(880px, calc(100vw - 28px));
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
}

.tutorial-video-player-video {
  display: block;
  width: 100%;
  max-height: 72vh;
  background: #000;
}

.tutorial-video-player-info {
  padding: 14px 18px;
  background: var(--surface-2);
  color: var(--ink);
}

.tutorial-video-player-info strong {
  display: block;
  font-size: 15px;
}

.tutorial-video-player-info p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.tutorial-video-player-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  border: 0;
}

@media (max-width: 1024px) {
  .skill-ide {
    grid-template-columns: 1fr;
  }
  .skill-file-editor {
    min-height: 50vh;
  }
}

/* 2026-07-16 提示词库：文件型 Skill 绑定标注（问题2）。用主题无关的中性弱化配色，明暗皆可读。 */
.skill-chip {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  border-radius: 999px;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.32);
  vertical-align: middle;
  white-space: nowrap;
}
.skill-bound-note {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: color-mix(in srgb, currentColor 62%, transparent);
  opacity: 0.85;
}

/* ============================================================
   2026-07-16 后台「账户管理」全面重设计
   页面结构：可折叠「注册与邀请」面板 + 用户列表为主区；管理仍走右侧抽屉但重做。
   末尾权威层，按源码顺序覆盖上方旧的用户管理规则；全部走三主题 token。
   ============================================================ */
.account-admin-layout { display: flex; flex-direction: column; gap: 16px; }

/* —— 折叠面板：注册与邀请 —— */
.reg-invite-panel { padding: 0; overflow: hidden; }
.reg-invite-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 15px 20px; background: transparent; border: none;
  cursor: pointer; text-align: left; color: var(--ink); font: inherit;
}
.reg-invite-toggle:hover { background: var(--surface-2); }
.reg-invite-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.reg-invite-icon {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 11px; background: var(--teal-soft); color: var(--teal); font-size: 17px;
}
.reg-invite-title-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.reg-invite-title-text strong { font-size: 15px; color: var(--ink); }
.reg-invite-title-text small { font-size: 12px; }
.reg-invite-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.reg-invite-caret { color: var(--muted); font-size: 11px; transition: transform .25s ease; }
.reg-invite-panel.open .reg-invite-caret { transform: rotate(180deg); }
.reg-invite-content { display: none; padding: 4px 20px 20px; border-top: 1px solid var(--line); }
.reg-invite-panel.open .reg-invite-content { display: block; }
.reg-invite-controls { padding-top: 14px; }
.reg-switch { margin-bottom: 4px; }
.reg-hint { margin: 4px 0 14px; font-size: 12.5px; }
.reg-invite-content .invite-create-row { margin-bottom: 16px; }
.invite-empty { margin: 4px 0 0; }

/* —— 用户主区头部 —— */
.user-panel-head { align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.user-count-chip {
  display: inline-block; margin-left: 4px; padding: 1px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; background: var(--teal-soft); color: var(--teal);
  vertical-align: middle;
}
.user-search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 12.5px; opacity: .55; pointer-events: none; }
.user-search-wrap .admin-search { padding-left: 34px; }

/* —— 用户表：卡片行 —— */
.user-overview-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.user-overview-table thead th {
  padding: 2px 16px; text-align: left; font-size: 12px; font-weight: 600;
  color: var(--muted); background: transparent; border: none;
}
.user-overview-table thead th.col-num { text-align: right; }
.user-overview-table thead th.col-manage { width: 92px; }
.user-overview-table tbody td {
  padding: 12px 16px; background: var(--surface-2); border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line); vertical-align: middle;
}
.user-overview-table tbody td:first-child { border-left: 1px solid var(--line); border-radius: 12px 0 0 12px; }
.user-overview-table tbody td:last-child { border-right: 1px solid var(--line); border-radius: 0 12px 12px 0; }
.user-row { cursor: pointer; }
.user-row:hover td { background: var(--surface); border-color: color-mix(in srgb, var(--teal) 55%, var(--line)); }
.user-row-disabled td { opacity: .55; }

.user-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-avatar {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: linear-gradient(180deg, #1688ff, #0068d9);
  color: #fff; font-weight: 700; font-size: 16px; text-transform: uppercase;
}
.user-avatar.is-admin { background: linear-gradient(180deg, #f5a524, #d97706); }
.user-cell-main { min-width: 0; }
.user-overview-table .user-cell-name strong { font-size: 14.5px; color: var(--ink); }
.user-cell-sub { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.user-sub-sep { opacity: .5; }
.user-uid { font-variant-numeric: tabular-nums; }

.user-overview-table td.col-num { text-align: right; }
.user-metric { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.user-metric-value { display: flex; align-items: baseline; gap: 3px; }
.user-metric-value strong { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.user-metric-value em { font-style: normal; font-size: 11px; color: var(--muted); }
.user-overview-table .user-metric small { display: block; margin-top: 0; font-size: 11.5px; color: var(--muted); }
.manage-btn { padding: 7px 16px; font-weight: 600; }
.user-empty {
  padding: 30px 16px !important; text-align: center; color: var(--muted);
  background: transparent !important; border: 1px dashed var(--line) !important; border-radius: 12px !important;
}

/* —— 抽屉重做：头部头像 + 概览卡 + 卡片式分区 + 底部栏 —— */
/* 面板背景沿用旧的不透明 --page（面板无 backdrop-filter，半透明叠深色遮罩会发灰）。 */
.user-drawer-identity { display: flex; align-items: flex-start; gap: 12px; min-width: 0; flex: 1; }
.drawer-avatar {
  width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(180deg, #1688ff, #0068d9); color: #fff; font-weight: 700; font-size: 18px; text-transform: uppercase;
}
.drawer-avatar.is-admin { background: linear-gradient(180deg, #f5a524, #d97706); }
.drawer-identity-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.user-drawer-body { display: flex; flex-direction: column; gap: 14px; padding: 16px 20px 22px; }
.drawer-section {
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface-2);
}
.drawer-section h3 { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: var(--ink); letter-spacing: 0; }
.drawer-overview { padding: 0; border: none; background: transparent; }
.drawer-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drawer-stat {
  display: flex; flex-direction: column; gap: 2px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
}
.drawer-stat-label { font-size: 11.5px; color: var(--muted); }
.drawer-stat strong { font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.drawer-stat strong.accent { color: var(--teal); }
.drawer-stat em { font-style: normal; font-size: 11px; color: var(--muted); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: color-mix(in srgb, var(--danger) 5%, var(--surface-2)); }
.user-drawer-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }

@media (max-width: 640px) {
  .user-search-wrap { width: 100%; }
  .user-search-wrap .admin-search { flex: 1; min-width: 0; }
  .drawer-stat-grid { grid-template-columns: 1fr; }
}

/* —— 邀请码使用记录（归档）2026-07-16 —— */
.invite-history { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.invite-history-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.invite-history-head h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); }
.invite-history-head .muted { font-size: 12px; }
.invite-history-list { display: flex; flex-direction: column; gap: 6px; }
.invite-history-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); font-size: 13px;
}
.invite-history-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1; }
.invite-history-main strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.invite-history-note { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-history-usage { flex: none; font-size: 12px; color: var(--muted); }
.invite-history-date { flex: none; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.icon-x {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer;
}
.icon-x:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* —— 邀请码：常用/测试 分区 + 当前测试码卡 2026-07-16 —— */
.invite-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.invite-section:first-of-type { margin-top: 10px; padding-top: 0; border-top: none; }
.invite-section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.invite-section-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.invite-section-head .muted { font-size: 12px; }

.test-code-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--teal) 32%, var(--line));
  border-radius: 14px; background: var(--teal-soft);
}
.test-code-current { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.test-code-label { font-size: 12px; color: var(--muted); }
.test-code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 24px; font-weight: 700; letter-spacing: 2px; color: var(--teal);
  user-select: all; word-break: break-all;
}
.test-code-actions { display: flex; gap: 8px; flex: none; }
.test-code-empty {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 18px; border: 1px dashed var(--line); border-radius: 14px; background: var(--surface-2);
}
.test-code-empty p { margin: 0; font-size: 13px; }

.invite-history-head h4 { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.invite-history-user {
  font-size: 12px; color: var(--teal);
  background: var(--teal-soft); padding: 1px 8px; border-radius: 999px;
}

/* ============================================================
   2026-07-16 「注册与邀请」板块全面重设计（覆盖上方旧的 invite 样式）
   真开关 + 常用码行内可编辑表格 + 测试码 hero + 使用记录折叠。全部走三主题 token。
   ============================================================ */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

/* 真·滑动开关 */
.toggle { position: relative; display: inline-flex; align-items: center; flex: none; cursor: pointer; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.toggle-track { width: 42px; height: 24px; border-radius: 999px; background: var(--line-2); transition: background .2s; position: relative; }
.toggle-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.toggle input:checked + .toggle-track { background: var(--teal); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }
.toggle.mini .toggle-track { width: 36px; height: 20px; }
.toggle.mini .toggle-track::after { width: 14px; height: 14px; }
.toggle.mini input:checked + .toggle-track::after { transform: translateX(16px); }

/* 注册开关行 */
.reg-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 4px; }
.reg-setting-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reg-setting-text strong { font-size: 14px; color: var(--ink); }
.reg-setting-text small { font-size: 12px; }

/* 分区 */
.invite-block { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.invite-block-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.invite-block-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.invite-block-head .muted { font-size: 12px; }
.invite-empty { padding: 18px 4px; font-size: 13px; }

/* 测试码 hero */
.test-code-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 18px 20px; border-radius: 16px; background: linear-gradient(135deg, var(--teal-soft), color-mix(in srgb, var(--teal) 9%, var(--surface-2))); border: 1px solid color-mix(in srgb, var(--teal) 30%, var(--line)); }
.test-code-hero-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.test-code-label { font-size: 12px; color: var(--muted); }
.test-code-value { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 26px; font-weight: 800; letter-spacing: 3px; color: var(--teal); user-select: all; word-break: break-all; line-height: 1.1; }
.test-code-hero-actions { display: flex; gap: 8px; flex: none; flex-wrap: wrap; }
.test-code-empty { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 20px; border: 1px dashed var(--line); border-radius: 16px; background: var(--surface-2); }
.test-code-empty-text { display: flex; flex-direction: column; gap: 2px; }
.test-code-empty-text strong { color: var(--ink); font-size: 14px; }
.test-code-empty-text small { font-size: 12px; }

/* 常用码：行内可编辑表格 */
.invite-table-wrap { overflow-x: auto; }
.invite-table { width: 100%; border-collapse: collapse; min-width: 460px; }
.invite-table thead th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 2px 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.invite-table th.col-num { text-align: right; }
.invite-table th.col-center { text-align: center; }
.invite-row { border-bottom: 1px solid var(--line); }
.invite-row:hover { background: var(--surface-2); }
.invite-row td { padding: 5px 10px; vertical-align: middle; }
.invite-row td.col-num { text-align: right; }
.invite-row td.col-center { text-align: center; }
.invite-row td.col-action { text-align: right; width: 42px; }
.invite-row-off { opacity: .5; }
.cell-input { width: 100%; border: 1px solid transparent; border-radius: 8px; background: transparent; padding: 7px 9px; font-size: 13px; color: var(--ink); transition: border-color .15s, background .15s; }
.cell-input::placeholder { color: var(--muted); opacity: .6; }
.cell-input:hover { border-color: var(--line); }
.cell-input:focus { border-color: var(--teal); background: var(--surface); outline: none; }
.cell-input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-weight: 600; letter-spacing: .5px; }
.cell-input.num { width: 74px; text-align: right; }
.invite-used { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

/* 使用记录：折叠 details */
details.invite-history { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); overflow: hidden; padding: 0; }
.invite-history-summary { cursor: pointer; list-style: none; padding: 11px 14px; font-size: 13px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.invite-history-summary::-webkit-details-marker { display: none; }
.invite-history-summary::before { content: '\25B8'; color: var(--muted); font-size: 11px; transition: transform .2s; }
details[open] > .invite-history-summary::before { transform: rotate(90deg); }
.invite-history-count { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
.invite-history-list { display: flex; flex-direction: column; gap: 6px; padding: 0 12px 12px; }
.invite-history-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 13px; }
.invite-history-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1; }
.invite-history-main .mono { color: var(--ink); font-variant-numeric: tabular-nums; }
.invite-history-user { flex: none; font-size: 11.5px; color: var(--teal); background: var(--teal-soft); padding: 1px 8px; border-radius: 999px; }
.invite-history-note { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-history-usage { flex: none; font-size: 12px; color: var(--muted); }
.invite-history-date { flex: none; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .test-code-hero, .test-code-empty, .reg-setting-row { align-items: flex-start; }
  .test-code-hero-actions { width: 100%; }
}
