:root {
  --bg: #0c0e14;
  --panel: #131722;
  --border: #252a38;
  --text: #e9ecf1;
  --muted: #8b93a7;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.18);
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

.shell {
  display: grid;
  grid-template-columns: minmax(300px, 38%) 1fr;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

@media (max-width: 880px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(320px, 55vh);
  }
}

.chat-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #10131c 0%, var(--panel) 40%);
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.chat-head h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.chat-sub {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.chat-sub code {
  font-size: 0.78em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: #0a0c12;
  border: 1px solid var(--border);
}

.gen-progress {
  padding: 0.35rem 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: #0e1118;
}

.gen-quality {
  padding: 0.5rem 1rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #c4c9d4;
  border-bottom: 1px solid var(--border);
  background: rgba(251, 191, 36, 0.06);
}

.gen-quality h3 {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: #fbbf24;
}

.gen-quality ul {
  margin: 0;
  padding-left: 1.1rem;
}

.gen-quality li {
  margin: 0.2rem 0;
}

.gen-progress[hidden] {
  display: none !important;
}

.chat-log {
  flex: 1;
  min-height: 0;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.chat-log,
.composer-shell textarea {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 211, 252, 0.38) rgba(99, 102, 241, 0.06);
}

.chat-log::-webkit-scrollbar,
.composer-shell textarea::-webkit-scrollbar {
  width: 12px;
}

.chat-log::-webkit-scrollbar-track,
.composer-shell textarea::-webkit-scrollbar-track {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.04), rgba(15, 23, 42, 0.14));
  border-left: 1px solid rgba(148, 163, 184, 0.08);
}

.chat-log::-webkit-scrollbar-thumb,
.composer-shell textarea::-webkit-scrollbar-thumb {
  min-height: 3rem;
  border: 3px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(96, 165, 250, 0.92), rgba(34, 211, 238, 0.82)) padding-box;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(56, 189, 248, 0.08);
}

.chat-log::-webkit-scrollbar-thumb:hover,
.composer-shell textarea::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(125, 211, 252, 0.98), rgba(59, 130, 246, 0.88)) padding-box;
}

.chat-log::-webkit-scrollbar-corner,
.composer-shell textarea::-webkit-scrollbar-corner {
  background: transparent;
}

.bubble {
  max-width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble.user {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid #3c4170;
}

.bubble.assistant {
  align-self: flex-start;
  background: #0f141d;
  border: 1px solid var(--border);
}

.bubble.assistant.streaming .stream-pre {
  margin: 0.35rem 0 0;
  padding: 0.5rem 0.55rem;
  max-height: 40vh;
  overflow: auto;
  font-size: 0.78rem;
  line-height: 1.45;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  background: #0a0d14;
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-summary {
  margin: 0.25rem 0 0;
  display: grid;
  gap: 0.35rem;
}

.bubble-summary-text {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text);
}

.bubble-summary-toggle {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: #a5b4fc;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.bubble-summary-toggle:hover {
  color: #c7d2fe;
  text-decoration: underline;
}

.assistant-raw-fold {
  margin-top: 0.45rem;
}

.assistant-raw-fold summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: #a5b4fc;
  user-select: none;
}

.assistant-raw {
  margin: 0.35rem 0 0;
  padding: 0.5rem 0.55rem;
  max-height: 35vh;
  overflow: auto;
  font-size: 0.76rem;
  line-height: 1.45;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  background: #0a0d14;
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble .role {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.chat-form {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 0.5rem;
  position: relative;
}

.chat-form.is-busy .composer-shell,
.chat-form.is-busy .link-prompt {
  pointer-events: none;
}

.chat-form.is-busy::after {
  content: "";
  position: absolute;
  inset: 0.4rem 0.7rem 0.7rem;
  border-radius: 18px;
  background: rgba(10, 13, 20, 0.48);
  border: 1px solid rgba(148, 163, 184, 0.12);
  backdrop-filter: blur(3px);
  z-index: 3;
  cursor: progress;
}

.composer-shell {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.8rem 0.85rem 0.7rem;
  border: 1px solid rgba(129, 140, 248, 0.18);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(10, 13, 20, 0.98)),
    #0c0f16;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 18px 42px rgba(2, 6, 23, 0.2);
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.45rem 0.55rem 0.45rem 0.45rem;
  border-radius: 12px;
  border: 1px solid rgba(129, 140, 248, 0.18);
  background: rgba(15, 23, 42, 0.82);
}

.attachment-chip__thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.14);
  color: #c7d2fe;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.attachment-chip__thumb--image {
  object-fit: cover;
}

.attachment-chip__body {
  min-width: 0;
}

.attachment-chip__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--text);
}

.attachment-chip__meta {
  margin-top: 0.12rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.attachment-chip__remove {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #cbd5f5;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.2rem 0.3rem;
  border-radius: 999px;
}

.attachment-chip__remove:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #ffffff;
}

.composer-shell textarea {
  width: 100%;
  resize: vertical;
  min-height: 96px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}

.chat-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 0.9rem;
}

.file-pick input {
  display: none;
}

.chat-toolbar__group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
}

.chat-toolbar__group--actions {
  margin-left: auto;
  justify-content: flex-end;
}

.composer-tool span {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.7);
  font-size: 0.82rem;
  color: #dbe4ff;
  cursor: pointer;
}

.composer-paste-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.flow-mode {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.flow-mode select {
  min-height: 2rem;
  padding: 0.35rem 1.8rem 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  font: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: #1a2030;
  color: var(--text);
  font: inherit;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.btn.primary {
  background: var(--accent-soft);
  border-color: #4f54c9;
}

.btn.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.link-prompt {
  font-size: 0.82rem;
  color: #a5b4fc;
}

.preview-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #0a0c11;
}

.preview-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: #0e1118;
}

.preview-head__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  width: 100%;
}

.preview-head__title-row h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.preview-head__title-row .auth-bar {
  margin-left: auto;
  flex-shrink: 0;
}

.preview-toolbar-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  width: 100%;
  min-width: 0;
}

.preview-toolbar-line .preview-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: 0;
  justify-content: flex-start;
  flex: 0 0 auto;
  position: relative;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  justify-content: flex-end;
  flex: 0 1 auto;
  text-align: right;
  position: relative;
}

.auth-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 0.25rem;
}

/* 已登录只显示用户与退出；.btn 的 display 会覆盖默认 [hidden]，需按状态强制隐藏 */
#auth-bar.auth-bar--logged-in #btn-auth-login {
  display: none !important;
}

#auth-bar.auth-bar--logged-out #btn-auth-logout,
#auth-bar.auth-bar--logged-out #auth-user-label {
  display: none !important;
}

.auth-user-label {
  font-size: 0.75rem;
  color: var(--muted, #94a3b8);
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
}

.preview-pick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  white-space: nowrap;
  border-color: rgba(34, 211, 238, 0.5);
  background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  color: #f8fbff;
  box-shadow:
    0 10px 24px rgba(37, 99, 235, 0.28),
    0 0 0 1px rgba(125, 211, 252, 0.16);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    filter 140ms ease,
    border-color 140ms ease;
}

.preview-pick-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: saturate(1.08);
  box-shadow:
    0 14px 30px rgba(37, 99, 235, 0.34),
    0 0 0 1px rgba(125, 211, 252, 0.22);
}

.preview-pick-btn--preview {
  border-color: rgba(167, 139, 250, 0.48);
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  box-shadow:
    0 10px 24px rgba(124, 58, 237, 0.26),
    0 0 0 1px rgba(196, 181, 253, 0.14);
}

.preview-pick-btn--preview:hover {
  box-shadow:
    0 14px 30px rgba(124, 58, 237, 0.32),
    0 0 0 1px rgba(196, 181, 253, 0.2);
}

.preview-pick-btn--publish {
  border-color: rgba(52, 211, 153, 0.48);
  background: linear-gradient(135deg, #059669 0%, #14b8a6 100%);
  box-shadow:
    0 10px 24px rgba(5, 150, 105, 0.26),
    0 0 0 1px rgba(110, 231, 183, 0.14);
}

.preview-pick-btn--publish:hover:not(:disabled) {
  box-shadow:
    0 14px 30px rgba(5, 150, 105, 0.32),
    0 0 0 1px rgba(110, 231, 183, 0.2);
}

.preview-pick-btn--danger {
  position: relative;
  border-color: rgba(248, 113, 113, 0.52);
  background: linear-gradient(135deg, #dc2626 0%, #f97316 100%);
  box-shadow:
    0 10px 24px rgba(220, 38, 38, 0.28),
    0 0 0 1px rgba(254, 202, 202, 0.16);
}

.preview-pick-btn--danger::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #fff1f2;
  box-shadow: 0 0 0 4px rgba(255, 241, 242, 0.14);
}

.preview-pick-btn--danger:hover:not(:disabled) {
  filter: saturate(1.1);
  box-shadow:
    0 14px 30px rgba(220, 38, 38, 0.34),
    0 0 0 1px rgba(254, 202, 202, 0.24),
    0 0 0 6px rgba(248, 113, 113, 0.12);
}

.preview-pick-btn--danger:focus-visible {
  outline: 2px solid rgba(254, 202, 202, 0.92);
  outline-offset: 2px;
  box-shadow:
    0 14px 30px rgba(220, 38, 38, 0.34),
    0 0 0 1px rgba(254, 202, 202, 0.24),
    0 0 0 6px rgba(248, 113, 113, 0.12);
}

.preview-pick-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  font-size: 0.875rem;
  line-height: 1;
}

.preview-pick-btn[aria-pressed="true"] {
  border-color: rgba(186, 230, 253, 0.85);
  background: linear-gradient(135deg, #1d4ed8 0%, #0891b2 100%);
}

.preview-pick-btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  box-shadow: none;
}

/* Unified custom tooltips for preview toolbar (same chrome as former pick-status bubble) */
.preview-toolbar-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.preview-toolbar-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 0.42rem);
  right: 0;
  left: auto;
  z-index: 12;
  display: block;
  width: max-content;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.58);
  background: linear-gradient(
    165deg,
    rgba(15, 23, 42, 0.99) 0%,
    rgba(8, 47, 73, 0.97) 45%,
    rgba(14, 116, 144, 0.94) 100%
  );
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.32),
    0 14px 38px rgba(2, 6, 23, 0.58),
    0 0 32px rgba(34, 211, 238, 0.22);
  color: #e8f0fe;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: normal;
  text-align: left;
  pointer-events: none;
  transform: translateY(-0.2rem);
  opacity: 0;
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.preview-toolbar-tooltip:is(:hover, :focus-within)::after {
  opacity: 1;
  transform: translateY(0);
}

.pick-status[data-tone="active"]::after {
  color: #c7d2fe;
  border-color: rgba(129, 140, 248, 0.72);
  background: linear-gradient(
    165deg,
    rgba(30, 27, 75, 0.98) 0%,
    rgba(49, 46, 129, 0.95) 50%,
    rgba(67, 56, 202, 0.9) 100%
  );
  box-shadow:
    0 0 0 1px rgba(165, 180, 252, 0.45),
    0 14px 38px rgba(2, 6, 23, 0.55),
    0 0 36px rgba(129, 140, 248, 0.28);
}

.pick-status[data-tone="success"]::after {
  color: #bbf7d0;
  border-color: rgba(52, 211, 153, 0.65);
  background: linear-gradient(
    165deg,
    rgba(6, 78, 59, 0.96) 0%,
    rgba(5, 46, 22, 0.97) 55%,
    rgba(20, 83, 45, 0.95) 100%
  );
  box-shadow:
    0 0 0 1px rgba(74, 222, 128, 0.38),
    0 14px 38px rgba(2, 6, 23, 0.55),
    0 0 32px rgba(52, 211, 153, 0.22);
}

.pick-status[data-tone="error"]::after {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.72);
  background: linear-gradient(
    165deg,
    rgba(69, 10, 10, 0.98) 0%,
    rgba(91, 15, 15, 0.96) 45%,
    rgba(127, 29, 29, 0.92) 100%
  );
  box-shadow:
    0 0 0 1px rgba(252, 165, 165, 0.42),
    0 14px 38px rgba(2, 6, 23, 0.55),
    0 0 36px rgba(248, 113, 113, 0.25);
}

.publish-feedback {
  flex-basis: 100%;
  margin: 0.15rem 0 0;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.45;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: rgba(8, 12, 21, 0.94);
  color: var(--muted);
  word-break: break-word;
}

.publish-feedback[data-tone="active"] {
  color: #c7d2fe;
  border-color: rgba(129, 140, 248, 0.35);
}

.publish-feedback[data-tone="success"] {
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.28);
}

.publish-feedback[data-tone="error"] {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.3);
}

.publish-feedback a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.page-tabs {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex: 1 1 12rem;
  min-width: 0;
  width: auto;
  margin-left: 0;
  justify-content: flex-end;
  position: relative;
}

.page-tabs-current,
.page-tabs-trigger {
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.2;
}

.page-tabs-current {
  max-width: min(24rem, 48vw);
  padding: 0.48rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #384057;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.16), rgba(99, 102, 241, 0.08));
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-tabs-current::before {
  content: "当前页";
  display: inline-block;
  margin-right: 0.55rem;
  color: #a5b4fc;
}

.page-tabs-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.48rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #151a24;
  color: var(--muted);
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    color 120ms ease;
}

.page-tabs-trigger:hover,
.page-tabs-trigger[aria-expanded="true"] {
  color: var(--text);
  border-color: #4f54c9;
  background: #1a2030;
}

.page-tabs-count {
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  background: #0d1018;
  color: #c7d2fe;
  font-size: 0.75rem;
}

.page-tabs .empty-hint {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  font-size: 0.82rem;
  color: var(--muted);
}

.page-tabs-popover {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  width: min(28rem, calc(100vw - 2rem));
  max-height: min(28rem, 62vh);
  overflow: auto;
  padding: 0.85rem;
  border-radius: 14px;
  border: 1px solid #2a3143;
  background:
    linear-gradient(180deg, rgba(20, 24, 34, 0.98), rgba(12, 15, 22, 0.98));
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(99, 102, 241, 0.06);
  z-index: 4;
}

.page-tabs-group + .page-tabs-group {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.page-tabs-group-title {
  margin: 0 0 0.5rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b93a7;
}

.page-tabs-group-list {
  display: grid;
  gap: 0.45rem;
}

.page-tab-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  width: 100%;
  padding: 0.6rem 0.72rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #111621;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    transform 120ms ease;
}

.page-tab-option:hover {
  border-color: #353d52;
  background: #161c28;
  transform: translateY(-1px);
}

.page-tab-option.active {
  border-color: #4f54c9;
  background: var(--accent-soft);
}

.page-tab-label {
  font-size: 0.84rem;
  line-height: 1.35;
  word-break: break-word;
}

.page-tab-path {
  font-size: 0.74rem;
  color: var(--muted);
  word-break: break-all;
}

.page-tab-option.active .page-tab-path {
  color: #c7d2fe;
}

.page-tabs-popover[hidden] {
  display: none !important;
}

@media (max-width: 880px) {
  .preview-toolbar-line {
    flex-direction: column;
    align-items: stretch;
  }

  .preview-toolbar-line .preview-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .page-tabs {
    width: 100%;
  }

  .page-tabs-current {
    flex: 1 1 16rem;
    max-width: none;
  }

  .page-tabs-trigger {
    margin-left: auto;
  }

  .page-tabs-popover {
    left: 0;
    right: auto;
    width: min(100%, 28rem);
  }
}

.preview-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* —— 网站管理页 —— */
body.site-management-page {
  overflow: auto;
  height: auto;
  min-height: 100vh;
}

.site-management.shell {
  display: flex;
  flex-direction: column;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2.5rem;
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

.site-management__header {
  display: flex;
  flex-flow: row wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.site-management__title-row {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.site-management__title-lead {
  display: flex;
  flex-flow: row wrap;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}

.site-management__title-row .auth-bar {
  margin-left: auto;
  flex-shrink: 0;
}

.site-management__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.link-muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.site-management__table-toolbar {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.site-management__search-wrap--toolbar {
  display: flex;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
}

.site-management__search-wrap--toolbar .site-management__search {
  width: min(100%, 320px);
  margin-left: auto;
}

.site-management__search {
  width: min(100%, 320px);
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

.site-management__table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.site-management__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.site-management__table th,
.site-management__table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.site-management__table th {
  color: var(--muted);
  font-weight: 500;
}

.cell-domain {
  max-width: 14rem;
  word-break: break-word;
}

.cell-actions {
  white-space: nowrap;
}

.cell-actions .btn {
  margin-right: 0.35rem;
}

.site-management__loading,
.site-management__empty,
.site-management__error {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem !important;
}

.site-management__error {
  color: #f87171;
}

.site-management__pagination {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

.pagination-info {
  color: var(--muted);
  font-size: 0.88rem;
}

.pagination-buttons {
  display: flex;
  gap: 0.5rem;
}

.chat-head__link {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.chat-head__link:hover {
  color: var(--accent);
}

.studio-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  background: var(--panel);
  color: var(--text);
  max-width: min(100%, 420px);
}

.studio-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.studio-dialog h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.studio-dialog form {
  padding: 1.25rem;
}

.studio-dialog label {
  display: block;
  margin: 0.75rem 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.studio-dialog input,
.studio-dialog select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.dialog-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.req {
  color: #f87171;
}
