:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --panel: #ffffff;
  --soft: #eef3f8;
  --line: #dbe4ef;
  --text: #172033;
  --muted: #667085;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --cyan: #06b6d4;
  --green: #10b981;
  --amber: #f59e0b;
  --danger: #ef4444;
  --shadow-soft: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-panel: 0 1px 2px rgba(15, 23, 42, 0.05), 0 12px 28px rgba(15, 23, 42, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; min-width: 320px; min-height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

@media (min-width: 1024px) {
  body { overflow: hidden; }
}

* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; }

.app {
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  overflow: hidden;
  background: white;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .08);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand__logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand__copy { min-width: 0; }
.brand__name { font-size: 17px; font-weight: 700; line-height: 1.2; }
.brand__sub { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }

.workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 390px;
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: 16px;
  padding: 16px;
}
@media (min-width: 1024px) {
  .app { height: 100vh; display: flex; flex-direction: column; }
  .workspace { flex: 1; min-height: 0; }
}

.studio-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
}
.side-panel,
.assistant-panel,
.main-column {
  min-height: 0;
}
.side-panel,
.assistant-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.side-panel { padding: 16px; gap: 16px; }
.main-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}
.editor-panel,
.book-panel,
.history-panel,
.beauty-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.book-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.workspace-switch {
  flex: 0 0 auto;
  display: inline-flex;
  align-self: flex-start;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: var(--shadow-panel);
}
.switch-btn {
  min-width: 96px;
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}
.switch-btn.is-active {
  background: var(--primary);
  color: white;
}
.workspace-panel {
  display: none;
  flex: 1;
  min-height: 0;
}
.workspace-panel.is-active {
  display: flex;
  min-height: 0;
}

.studio-label {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.panel-title,
.panel-header,
.assistant-head,
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.panel-header h1,
.panel-header h2,
.assistant-head h2,
.modal__head h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.2;
  font-weight: 700;
}
.panel-hint { color: var(--muted); font-size: 12px; white-space: nowrap; }

.studio-input,
.studio-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.studio-input {
  min-height: 42px;
  padding: 9px 12px;
  font-size: 14px;
}
.studio-textarea {
  padding: 12px 13px;
  line-height: 1.65;
  resize: none;
  font-size: 14px;
  font-family: "JetBrains Mono", "Fira Code", "Microsoft YaHei", monospace;
}
.studio-input:focus,
.studio-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.studio-textarea--large { min-height: 100%; }

.studio-button,
.studio-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.studio-button {
  gap: 8px;
  min-height: 40px;
  border-radius: 12px;
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.studio-button--small { min-height: 34px; padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.studio-button--primary { background: var(--primary); color: white; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.studio-button--primary:hover { background: #1d4ed8; }
.studio-button--secondary { border: 1px solid var(--line); background: white; color: var(--text); }
.studio-button--secondary:hover { background: var(--soft); }
.studio-button--danger { background: #fee2e2; color: #b91c1c; }
.studio-button--full { width: 100%; }
.studio-icon-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  font-size: 18px;
}
.studio-icon-button:hover { background: var(--soft); color: var(--text); }
.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 8px;
}
.text-button:hover { background: var(--soft); color: var(--text); }
.text-button--danger { color: #dc2626; }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill--ok { background: #ecfdf5; color: #047857; }
.status-pill--warn { background: #fffbeb; color: #b45309; }

.avatar-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}
.avatar-card__image {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: white;
}
.avatar-card__image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-card__meta { display: grid; gap: 10px; min-width: 0; }
.side-panel__fields { display: grid; gap: 12px; }
.meeting-controls {
  min-height: 0;
  display: grid;
  gap: 12px;
}
.meeting-add-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.meeting-source {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfdff;
}
.meeting-source__label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.meeting-source__summary {
  font-weight: 800;
  color: var(--text);
  line-height: 1.4;
}
.meeting-participant-list {
  display: grid;
  gap: 10px;
  max-height: min(44vh, 480px);
  overflow: auto;
}
.meeting-participant {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.meeting-participant__body {
  min-width: 0;
  display: grid;
  gap: 8px;
}
.meeting-participant__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.meeting-participant__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}
.meeting-participant__badge {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #f8fafc;
  font-size: 11px;
  font-weight: 800;
}
.meeting-participant__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.meeting-participant__meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.meeting-auto-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}
.meeting-panel {
  flex-direction: column;
  min-height: 0;
}
.meeting-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.meeting-panel__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}
.beauty-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.beauty-workshop {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 12px;
  padding: 14px;
  padding-top: 0;
}
.beauty-section {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  overflow: hidden;
}
.beauty-section__head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.beauty-section__head h3 {
  margin: 2px 0 0;
  font-size: 15px;
}
.beauty-textarea {
  flex: 1;
  min-height: 0;
  resize: none;
  font-family: "Cascadia Mono", "Consolas", monospace;
}
.beauty-code-input,
.beauty-regex-area {
  font-family: "Cascadia Mono", "Consolas", monospace;
}
.beauty-regex-name-input {
  color: var(--muted);
  font-family: "Cascadia Mono", "Consolas", monospace;
}
.beauty-regex-name-input::placeholder {
  color: var(--muted);
  opacity: .72;
}
.beauty-section--regex { overflow: auto; }
.beauty-regex-area {
  min-height: 88px;
  resize: vertical;
}
.beauty-regex-options {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.beauty-regex-settings {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.beauty-regex-settings__group,
.beauty-regex-settings__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.beauty-regex-settings__group > .studio-label {
  flex: 0 0 72px;
}
.field--compact {
  gap: 5px;
  min-width: 132px;
}
.field--compact .studio-input {
  min-height: 34px;
}
.beauty-error {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.5;
}
.beauty-preview {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.beauty-preview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.preview-mode-toggle {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.preview-mode-toggle__btn {
  min-width: 42px;
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.preview-mode-toggle__btn.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}
.beauty-preview__frame {
  width: min(100%, 390px);
  height: 100%;
  min-height: 320px;
  display: block;
  border: 0;
  background: white;
  margin: 0 auto;
}
.beauty-preview.is-desktop .beauty-preview__frame {
  width: 1024px;
  max-width: none;
  margin: 0 auto;
}
.beauty-preview.is-mobile {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.beauty-preview.is-mobile::-webkit-scrollbar {
  display: none;
}
.beauty-preview-modal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: min(760px, calc(100vh - 190px));
}
.beauty-preview-modal__frame {
  flex: 1;
  width: min(100%, 390px);
  min-height: min(720px, calc(100vh - 230px));
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  margin: 0 auto;
}
.beauty-preview-modal.is-desktop {
  overflow: auto;
}
.beauty-preview-modal.is-desktop .beauty-preview-modal__frame {
  width: 1024px;
  max-width: none;
  margin: 0 auto;
}
.beauty-preview-modal.is-mobile {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.beauty-preview-modal.is-mobile::-webkit-scrollbar {
  display: none;
}
.beauty-preview__plain {
  margin: 0;
  white-space: pre-wrap;
  color: var(--text);
  font: inherit;
  line-height: 1.7;
}
.beauty-preview__empty {
  height: 100%;
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}
.meeting-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px;
}
.meeting-log__item {
  width: min(78%, 720px);
  display: grid;
  gap: 5px;
  line-height: 1.6;
}
.meeting-log__name {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.meeting-log__bubble {
  width: fit-content;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: white;
  white-space: pre-wrap;
}
.meeting-log__item--user {
  align-self: flex-end;
  justify-items: end;
}
.meeting-log__item--user .meeting-log__bubble {
  background: #dcfce7;
  border-color: #bbf7d0;
}
.meeting-log__item--assistant {
  align-self: flex-start;
  justify-items: start;
}
.meeting-log__item--assistant .meeting-log__bubble {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.meeting-log__item--system {
  align-self: center;
  justify-items: center;
  width: min(90%, 640px);
}
.meeting-log__item--system .meeting-log__bubble {
  background: #f8fafc;
  color: var(--muted);
}
.meeting-composer {
  display: grid;
  gap: 10px;
}
.meeting-input-wrap {
  position: relative;
  min-width: 0;
}
.mention-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  max-height: min(240px, 42vh);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow-panel);
  padding: 6px;
}
.mention-menu__item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  text-align: left;
}
.mention-menu__item:hover,
.mention-menu__item.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}
.mention-menu__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}
.mention-menu__handle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.field { display: grid; gap: 7px; }
.field--inline { grid-template-columns: 72px 110px; align-items: center; width: fit-content; }

.field-picker {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.section-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
}
.tab-btn {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--text);
  padding: 9px 11px;
  text-align: left;
  font-weight: 600;
}
.tab-btn:hover { background: var(--soft); }
.tab-btn.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.editor-wrap {
  flex: 1;
  min-height: 0;
  padding: 14px;
  display: flex;
}
.editor-wrap .studio-textarea {
  flex: 1;
  min-height: 0;
}
.depth-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}
.depth-panel .field:last-child {
  flex: 1;
  min-height: 0;
}
.depth-panel .field:last-child .studio-textarea {
  flex: 1;
  min-height: 0;
}
.creator-meta-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
}
.creator-meta-panel .studio-textarea {
  min-height: auto;
  resize: vertical;
}
.greeting-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
}
.greeting-block,
.alternate-greeting {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfdff;
  padding: 12px;
}
.greeting-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.greeting-textarea {
  min-height: 180px;
  resize: vertical;
}
.alternate-greeting-list {
  display: grid;
  gap: 10px;
}

.book-panel.workspace-panel.is-active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.book-panel .entry-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}
.history-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.history-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 12px;
}
.history-character {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  overflow: hidden;
}
.history-character__head {
  width: 100%;
  min-height: 46px;
  background: #fbfdff;
  color: var(--text);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  font-weight: 800;
  text-align: left;
}
.history-character__select {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 0;
  font-weight: 800;
  text-align: left;
}
.history-character__avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: white;
}
.history-character__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-character__count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.history-character__delete {
  min-width: 44px;
  border: 1px solid rgba(239, 68, 68, .24);
  border-radius: 8px;
  background: #fff5f5;
  color: #b42318;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
}
.history-character__delete:hover {
  background: #fee2e2;
  border-color: rgba(239, 68, 68, .42);
}
.history-character.is-active .history-character__head {
  border-bottom: 1px solid var(--line);
}
.history-versions {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #ffffff;
}
.history-version {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  padding: 9px 10px;
}
.history-version.is-current {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.history-version__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.history-version__check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
.history-version__main {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  gap: 3px;
  padding: 0;
  text-align: left;
}
.history-version__main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}
.history-version__main small,
.history-empty {
  color: var(--muted);
  font-size: 12px;
}
.worldbook-entry {
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  overflow: hidden;
}
.worldbook-entry__head {
  width: 100%;
  border: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fbfdff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.worldbook-entry__head:hover { background: var(--soft); }
.worldbook-entry__id {
  min-width: 35px;
  color: var(--muted);
  font-size: 11px;
  flex: 0 0 auto;
}
.worldbook-entry__title {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.worldbook-entry__tags {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}
.worldbook-entry__chevron {
  color: var(--muted);
  font-size: 11px;
  flex: 0 0 auto;
}
.worldbook-tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  border-radius: 3px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
}
.worldbook-tag--more {
  background: transparent;
  color: var(--muted);
}
.worldbook-entry__body {
  padding: 12px;
  background: var(--bg);
}
.worldbook-entry__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.worldbook-field {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}
.worldbook-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.worldbook-field input,
.worldbook-field textarea,
.worldbook-inline select,
.worldbook-inline input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  color: var(--text);
  outline: none;
  font-size: 12px;
}
.worldbook-field input {
  min-height: 34px;
  padding: 6px 8px;
}
.worldbook-field textarea {
  height: 250px;
  padding: 8px 10px;
  line-height: 1.55;
  resize: vertical;
  font-family: "JetBrains Mono", "Fira Code", "Microsoft YaHei", monospace;
}
.worldbook-entry__options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}
.worldbook-inline,
.worldbook-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 11px;
}
.worldbook-inline select {
  width: auto;
  min-height: 26px;
  padding: 2px 4px;
}
.worldbook-inline input {
  width: 50px;
  min-height: 26px;
  padding: 2px 4px;
}
.worldbook-check input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
}
.worldbook-field input:focus,
.worldbook-field textarea:focus,
.worldbook-inline select:focus,
.worldbook-inline input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.worldbook-entry__footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.checkline { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.checkline input { width: 16px; height: 16px; accent-color: var(--primary); }

.assistant-panel {
  padding: 16px;
  gap: 12px;
}
.assistant-mode-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.assistant-head { flex: 0 0 auto; }
.beauty-reference-preview {
  min-height: 112px;
  display: grid;
  place-items: center;
  gap: 8px;
  overflow: hidden;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.beauty-reference-preview img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  display: block;
}
.beauty-reference-preview span {
  padding: 0 8px 8px;
  overflow-wrap: anywhere;
}
.beauty-apply-modal {
  width: min(900px, 94vw);
  max-height: min(760px, 92vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}
.beauty-apply-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 16px;
}
.beauty-apply-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}
.beauty-apply-item__head {
  justify-content: flex-start;
}
.beauty-apply-item__head strong {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}
.beauty-apply-item pre {
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border-radius: 10px;
  background: white;
  color: var(--text);
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.55;
}
.beauty-regex-picker-modal {
  width: min(940px, 94vw);
  max-height: min(780px, 92vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.beauty-regex-picker-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 4px 2px 2px;
}
.beauty-regex-picker-item {
  width: 100%;
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  color: var(--text);
  text-align: left;
}
.beauty-regex-picker-item:hover {
  border-color: rgba(37, 99, 235, .38);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}
.beauty-regex-picker-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.beauty-regex-picker-item__head strong {
  min-width: 0;
  overflow-wrap: anywhere;
}
.beauty-regex-picker-item__head span,
.beauty-regex-picker-item__meta {
  color: var(--muted);
  font-size: 12px;
}
.beauty-regex-picker-item code {
  display: block;
  max-width: 100%;
  padding: 8px;
  border-radius: 8px;
  background: #f3f6fb;
  color: #334155;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.prompt-box {
  flex: 0 0 auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
}
.prompt-desc {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.prompt-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.prompt-editor {
  min-height: 150px;
  max-height: 260px;
  overflow: auto;
  resize: vertical;
}
.chat-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}
.message-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.message-wrap--user {
  align-items: flex-end;
}
.message-wrap--assistant {
  align-items: flex-start;
}
.message {
  max-width: 92%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: white;
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 13px;
}
.message--user {
  align-self: flex-end;
  border-color: #bfdbfe;
  background: #eff6ff;
}
.message--assistant { align-self: flex-start; }
.message-actions {
  display: flex;
  gap: 8px;
}
.draft-box {
  flex: 0 0 auto;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 14px;
  padding: 12px;
}
.draft-box__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.draft-box pre {
  max-height: 180px;
  overflow: auto;
  margin: 10px 0;
  padding: 10px;
  border-radius: 10px;
  background: white;
  color: var(--muted);
  white-space: pre-wrap;
}
.pending-box {
  flex: 0 0 auto;
  border: 1px solid #fde68a;
  background: #fffbeb;
  border-radius: 14px;
  padding: 10px;
}
.pending-toggle {
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  font-weight: 800;
  text-align: left;
}
.pending-toggle__meta {
  flex: 0 0 auto;
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
}
.pending-box__body {
  max-height: min(34vh, 360px);
  overflow: auto;
  padding-top: 2px;
}
.pending-card {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.pending-card__title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
}
.pending-diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.pending-diff__col {
  min-width: 0;
}
.pending-diff__label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.pending-card pre {
  max-height: 150px;
  overflow: auto;
  margin: 8px 0;
  padding: 10px;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--muted);
  white-space: pre-wrap;
}
.pending-version {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin: 10px 0;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}
.btn--primary {
  background: var(--primary);
  color: white;
}
.btn--danger {
  background: #fee2e2;
  color: #b91c1c;
}
.button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.composer {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.composer textarea {
  min-height: 72px;
  max-height: 150px;
  resize: vertical;
}
.composer__actions { display: flex; flex-direction: column; gap: 8px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .36);
  backdrop-filter: blur(4px);
}
.modal__panel {
  position: relative;
  width: min(560px, 100%);
  padding: 18px;
}
.modal__panel--wide {
  width: min(1120px, 100%);
}
.modal__head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.modal__content {
  max-height: min(75vh, 900px);
  overflow: auto;
}
.meeting-card-picker {
  display: grid;
  gap: 12px;
}
.meeting-card-picker__list {
  max-height: min(58vh, 620px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding-right: 2px;
}
.meeting-card-picker__group {
  display: grid;
  gap: 8px;
}
.meeting-card-picker__group-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.meeting-card-option {
  width: 100%;
  display: grid;
  grid-template-columns: auto 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--text);
  text-align: left;
}
.meeting-card-option:hover,
.meeting-card-option.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.meeting-card-character {
  width: 100%;
  display: grid;
  grid-template-columns: 20px 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  color: var(--text);
  text-align: left;
}
.meeting-card-character:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.meeting-card-character__arrow {
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  text-align: center;
}
.meeting-card-versions {
  display: grid;
  gap: 8px;
  padding-left: 34px;
}
.meeting-card-versions .meeting-card-option {
  background: #fff;
}
.meeting-card-option__avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: white;
}
.meeting-card-option__meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.meeting-card-option__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
}
.meeting-card-option__version,
.meeting-card-option__time {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.meeting-card-picker__footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: white;
}
.settings-grid { display: grid; gap: 13px; }
.settings-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-text { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.model-picker {
  position: relative;
}
.model-picker__input {
  padding-right: 42px;
}
.model-picker__toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 40px;
  height: 40px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 11px 11px 0;
  background: white;
  color: var(--muted);
  font-size: 18px;
}
.model-picker__toggle:hover {
  background: var(--soft);
  color: var(--text);
}
.model-picker__list {
  position: absolute;
  z-index: 80;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow-panel);
}
.model-picker__option {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  display: block;
  padding: 7px 9px;
  text-align: left;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-picker__option:hover,
.model-picker__option.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}
.model-picker__empty {
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}
.doc-copy {
  display: grid;
  gap: 10px;
  color: var(--text);
  line-height: 1.7;
  font-size: 14px;
}
.doc-copy p {
  margin: 0;
}
.doc-copy h3 {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
.doc-alert {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fef2f2;
}
.doc-alert strong {
  color: #b91c1c;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 800;
}
.doc-support {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: #fffbeb;
  color: #92400e;
}
.doc-support strong,
.doc-support span {
  display: block;
}
.doc-support strong {
  font-size: 14px;
  line-height: 1.55;
}
.doc-support span {
  font-size: 13px;
  color: #a16207;
}
.doc-support__code {
  cursor: pointer;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  background: #fbbf24;
  color: #78350f;
  padding: 8px 12px;
  font: 800 14px/1 var(--font, inherit);
  min-height: 36px;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.18);
}
.doc-support__code:hover {
  background: #f59e0b;
}
.doc-support__tip {
  grid-column: 1 / -1;
  min-height: 18px;
  font-size: 13px;
  color: #15803d;
}
.proposal-preview {
  display: grid;
  gap: 12px;
}
.proposal-preview__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.proposal-preview__panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
  padding: 12px;
}
.proposal-preview__panel--single {
  min-height: 50vh;
}
.proposal-preview__label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.proposal-preview pre {
  min-height: min(58vh, 720px);
  margin: 0;
  overflow: auto;
  padding: 12px;
  border-radius: 10px;
  background: white;
  border: 1px solid var(--line);
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 14px;
}
.text-edit-modal {
  display: grid;
  gap: 12px;
}
.text-edit-modal textarea {
  min-height: min(62vh, 760px);
  resize: vertical;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfdff;
  padding: 14px;
  color: var(--muted);
  font-size: 14px;
}
.notice p { margin: 0; }

.mobile-tabs { display: none; }

@media (max-width: 1280px) and (min-width: 1024px) {
  .workspace { grid-template-columns: 300px minmax(0, 1fr) 350px; gap: 12px; padding: 12px; }
  .side-panel, .assistant-panel { padding: 12px; }
}

@media (max-width: 1023px) {
  body { overflow: auto; }
  .topbar { align-items: flex-start; padding: 10px 12px; }
  .brand__logo { width: 38px; height: 38px; }
  .brand__sub { display: none; }
  .topbar__actions { max-width: 62vw; overflow-x: auto; padding-bottom: 2px; }
  .status-pill { display: none; }
  .workspace {
    display: block;
    padding: 12px;
    padding-bottom: 74px;
  }
  .mobile-view { display: none; }
  .mobile-view.is-active { display: flex; }
  .main-column.mobile-view.is-active {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .side-panel.mobile-view.is-active,
  .assistant-panel.mobile-view.is-active {
    min-height: calc(100vh - 156px);
  }
  .side-panel { margin-bottom: 12px; }
  .editor-panel,
  .book-panel,
  .history-panel,
  .meeting-panel,
  .beauty-panel { min-height: calc(100vh - 210px); }
  .beauty-workshop {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(260px, auto));
    overflow: visible;
  }
  .editor-wrap { min-height: 380px; }
  .avatar-card { grid-template-columns: 96px minmax(0, 1fr); }
  .worldbook-entry__grid { grid-template-columns: 1fr; }
  .assistant-panel { min-height: calc(100vh - 156px); }
  .draft-box__grid,
  .meeting-participant,
  .meeting-auto-summary,
  .meeting-card-option,
  .meeting-card-character,
  .pending-version,
  .pending-diff,
  .proposal-preview__grid { grid-template-columns: 1fr; }
  .meeting-card-versions { padding-left: 0; }
  .meeting-card-picker__footer { align-items: stretch; flex-direction: column; }
  .mobile-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 8px;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
  }
  .mobile-tabs__item {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    color: var(--muted);
    font-weight: 700;
  }
  .mobile-tabs__item.is-active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
  }
}

@media (max-width: 640px) {
  .brand__name { font-size: 16px; }
  .topbar__actions .studio-button { padding: 8px 10px; font-size: 12px; }
  .topbar__actions .studio-icon-button { width: 36px; height: 36px; }
  .panel-header { padding: 14px; }
  .side-panel, .assistant-panel { padding: 12px; }
  .composer { grid-template-columns: 1fr; }
  .composer__actions { flex-direction: row; }
  .composer__actions .studio-button { flex: 1; }
}
