:root {
  color-scheme: light;
  --ink: #132620;
  --muted: #4e6760;
  --accent: #146549;
  --accent-hover: #0f5039;
  --paper: #fafcfb;
  --line: #d5e2db;
  --background: #edf3f0;
  --wash: #e1eee7;
  --white: #fff;
  --error: #a32927;
  --body: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
  font-family: var(--body);
  font-size: 16px;
  color: var(--ink);
  background: var(--background);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0; }
p { text-wrap: pretty; }
h1 { font-size: clamp(1.9rem, 4vw, 2.55rem); letter-spacing: -.035em; line-height: 1.12; }
h2 { font-size: 1.075rem; }
button, input, textarea, a.button { font: inherit; }
button, a.button {
  min-height: 44px; border-radius: 8px; border: 1px solid transparent; padding: 0 14px; cursor: pointer;
  font-size: .9rem; font-weight: 700; transition: background .15s ease, border-color .15s ease;
}
button:disabled { opacity: .53; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary { background: var(--accent); color: var(--white); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.secondary { background: var(--white); border-color: var(--line); color: var(--ink); }
.secondary:hover:not(:disabled), .quiet:hover:not(:disabled) { background: var(--wash); }
.quiet { background: transparent; color: var(--muted); }
.small { min-height: 36px; }
a.button { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.top-inner, .studio { width: min(1120px, calc(100% - 56px)); margin: auto; }
.top-inner { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand, .top-controls { display: flex; gap: 12px; align-items: center; }
.brand { font-weight: 750; }
.mark, .avatar { display: grid; place-items: center; background: var(--accent); color: var(--white); font-family: Georgia, serif; font-weight: 700; }
.mark { width: 34px; height: 34px; border-radius: 9px; font-size: 1.25rem; }
.connection { color: var(--muted); font-size: .84rem; white-space: nowrap; }
.connection[data-ready="true"] { color: var(--accent); }
.connection[data-ready="true"]::before { content: ""; display: inline-block; margin-right: .42rem; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.studio { padding: 34px 0 48px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.page-heading p { margin-top: 10px; color: var(--muted); }
.audience { white-space: nowrap; font-size: .875rem; color: var(--muted); }
.audience strong { color: var(--ink); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.setup { padding: 14px 18px; border: 1px solid var(--line); background: var(--wash); border-radius: 10px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.setup p { margin-top: 4px; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.setup code { display: inline-block; margin-top: 8px; padding: 5px 7px; background: var(--white); border-radius: 4px; overflow-wrap: anywhere; }
.bot-setup-form { margin-top: 12px; }
.bot-setup-form > div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; }
.bot-setup-form input { flex: 1 1 225px; }
.bot-setup-form .error:not(:empty) { color: var(--error); }
.layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; gap: 20px; }
.surface { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.staff-panel { margin-bottom: 18px; }
.staff-panel summary { padding: 16px 21px; cursor: pointer; font-weight: 750; }
.staff-content { border-top: 1px solid var(--line); padding: 16px 21px; }
.staff-form-actions, .staff-actions, .staff-review-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.staff-form-actions { margin-top: 8px; }
.staff-form-actions input { flex: 1 1 170px; max-width: 300px; }
.staff-panel .feedback:empty { display: none; }
#staff-empty { margin-top: 14px; }
.staff-list { list-style: none; margin: 12px 0 0; padding: 0; }
.staff-list:empty { display: none; }
.staff-list > li { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--line); padding: 12px 0 6px; }
.staff-list p { color: var(--muted); font-size: .84rem; margin-top: 4px; }
.staff-credential { background: var(--wash); border: 1px solid var(--line); border-radius: 9px; padding: 12px; margin-top: 12px; }
.staff-credential textarea { margin: 8px 0; min-height: 94px; overflow-wrap: anywhere; }
.staff-review { width: min(95%, 640px); max-height: 85vh; }
.staff-review-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.staff-review section { margin-top: 20px; }
.staff-review h3 { margin: 0 0 8px; font-size: .97rem; }
.staff-review section > p, .staff-review .records { margin: 8px 0 0; padding: 0; }
.staff-review .bubble p { margin: 0; }
.staff-review-links { margin-top: 8px; overflow-wrap: anywhere; }
.staff-review-links a, .staff-review .record a { color: var(--accent-hover); font-size: .9rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; min-height: 60px; padding: 10px 21px; gap: 12px; border-bottom: 1px solid var(--line); }
.section-title span, .count { color: var(--muted); font-size: .82rem; }
#editor-form { padding: 20px 21px; }
.field + .field { margin-top: 20px; }
label { font-size: .9rem; font-weight: 700; }
label span { margin-left: 5px; color: var(--muted); font-size: .8rem; font-weight: 400; }
.upload { position: relative; min-height: 76px; margin-top: 8px; display: flex; align-items: center; gap: 8px; padding: 12px; border: 1px dashed var(--line); border-radius: 9px; background: var(--white); }
.upload:hover, .upload:focus-within { border-color: var(--accent); }
.upload-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.upload svg { flex: 0 0 25px; color: var(--accent); }
.upload-info strong, .upload-info small { display: block; overflow-wrap: anywhere; }
.upload-info strong { font-size: .89rem; }
.upload-info small { font-size: .76rem; color: var(--muted); margin-top: 4px; }
.file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.remove { position: relative; margin-left: auto; flex-shrink: 0; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
input:not([type="file"]), textarea { width: 100%; border: 1px solid var(--line); background: var(--white); color: var(--ink); padding: 10px 12px; border-radius: 8px; min-height: 43px; }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 124px; line-height: 1.55; }
.button-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) auto; gap: 8px; align-items: start; margin-bottom: 8px; }
.button-row input { font-size: .875rem; min-width: 0; }
.button-row button { min-width: 44px; padding: 0 6px; }
.field-hint { color: var(--muted); font-size: .85rem; }
.feedback { min-height: 21px; margin-top: 14px; line-height: 1.45; font-size: .875rem; color: var(--accent); }
.error, .feedback[data-error="true"] { color: var(--error); }
.count[data-error="true"] { color: var(--error); }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.preview-body { padding: 18px; background: var(--wash); }
.conversation { border: 1px solid var(--line); border-radius: 11px; background: var(--background); overflow: hidden; }
.chat-top { display: flex; align-items: center; gap: 10px; background: var(--white); padding: 11px 13px; border-bottom: 1px solid var(--line); font-size: .875rem; font-weight: 700; }
.avatar { border-radius: 50%; width: 28px; height: 28px; font-size: .9rem; }
.chat-main { min-height: 264px; padding: 15px; }
.bubble { background: var(--white); border-radius: 12px 12px 12px 3px; border: 1px solid var(--line); overflow: hidden; }
.bubble img { display: block; max-width: 100%; width: 100%; max-height: 240px; object-fit: contain; background: var(--wash); }
.bubble p { padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .91rem; line-height: 1.55; }
.bubble p[data-empty="true"] { color: var(--muted); }
.preview-buttons { display: grid; gap: 6px; margin-top: 7px; }
.preview-buttons span { background: var(--accent); color: var(--white); padding: 8px; border-radius: 7px; text-align: center; font-size: .85rem; overflow-wrap: anywhere; }
.publish-area { padding: 16px 18px; display: grid; gap: 9px; border-top: 1px solid var(--line); }
.publish-area p { font-size: .83rem; color: var(--muted); }
.action-publish { color: var(--white); background: var(--ink); }
.action-publish:hover:not(:disabled) { background: var(--accent-hover); }
.channel-area { padding: 16px 18px; display: grid; gap: 8px; border-top: 1px solid var(--line); }
.channel-area h3 { margin: 0 0 4px; font-size: .98rem; }
.channel-area p { font-size: .83rem; color: var(--muted); }
.channel-area .channel-message[data-error="true"] { color: var(--error); }
.channel-message:empty { display: none; }
.channel-result > div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.channel-result input { flex: 1 1 175px; min-width: 0; }
.history { margin-top: 20px; }
.history > p, .records { padding: 14px 21px; color: var(--muted); font-size: .9rem; }
.records:empty { display: none; }
.record + .record { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.record { display: grid; grid-template-columns: minmax(130px, 1fr) 1fr; gap: 10px; }
.record strong { color: var(--ink); }
.record .result { text-align: right; }
.login { width: min(100% - 44px, 408px); margin: 12vh auto; padding: 26px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.login h1 { font-size: 1.8rem; margin-bottom: 24px; }
.login input { margin-top: 8px; }
.login .error { min-height: 25px; margin-top: 8px; font-size: .88rem; }
.login button { width: 100%; }
dialog { width: min(95%, 440px); padding: 22px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
dialog::backdrop { background: rgb(19 38 32 / .48); }
dialog p { margin: 10px 0 16px; color: var(--muted); line-height: 1.5; }
@media (max-width: 760px) {
  .top-inner, .studio { width: calc(100% - 30px); }
  .studio { padding-top: 24px; }
  .layout { grid-template-columns: 1fr; gap: 14px; }
  .page-heading { flex-wrap: wrap; align-items: center; }
  .section-title, #editor-form { padding-left: 14px; padding-right: 14px; }
  .button-row { grid-template-columns: minmax(0, 1fr) auto; }
  .button-row input:nth-child(2) { grid-row: 2; grid-column: 1 / -1; }
  .record { grid-template-columns: 1fr; }
  .record .result { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
