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

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e6ec;
  --border-focus: #1a56db;
  --text: #18191d;
  --text-secondary: #6b7280;
  --accent: #1a56db;
  --accent-hover: #1445b8;
  --accent-light: #eff4ff;
  --danger: #dc2626;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.07);
  --shadow-md: 0 2px 8px rgba(0,0,0,.09);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

/* ---- Nav ---- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border);
}
.nav-brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -.3px;
}
.nav-links { display: flex; gap: 22px; }
.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13.5px;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color .15s;
}
.nav-links a.active,
.nav-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.nav-user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.nav-user-role {
  font-size: 11px;
  color: var(--text-secondary);
  background: #eef2f7;
  border-radius: 999px;
  padding: 2px 8px;
}
.nav-logout-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
}
.nav-logout-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---- Container ---- */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -.2px;
}

/* ---- Login ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 28px 24px;
}
.login-brand {
  font-size: 14px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 10px;
}
.login-title {
  font-size: 24px;
  margin-bottom: 6px;
}
.login-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 18px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}
.login-input,
.admin-input,
.admin-select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
}
.login-input:focus,
.admin-input:focus,
.admin-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(26,86,219,.08);
}
.login-btn {
  width: 100%;
  margin-top: 6px;
}
.login-error {
  min-height: 18px;
  font-size: 12px;
  color: var(--danger);
}

/* ---- Admin ---- */
.admin-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.admin-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.admin-title {
  font-size: 17px;
  margin-bottom: 12px;
}
.admin-form {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 1.1fr 140px 100px;
  gap: 10px;
  align-items: center;
}
.admin-hint {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}
.admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-user-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}
.admin-user-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
.admin-user-name {
  font-size: 15px;
  font-weight: 700;
}
.admin-user-meta {
  font-size: 12px;
  color: var(--text-secondary);
}
.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---- Workspace ---- */
.workspace-container {
  max-width: 1120px;
}
.workspace-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 22px 24px;
  background:
    radial-gradient(circle at top left, rgba(26,86,219,.12), transparent 36%),
    linear-gradient(135deg, #ffffff 0%, #f6f9ff 100%);
  border: 1px solid rgba(26,86,219,.12);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.workspace-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.workspace-title {
  font-size: 36px;
  line-height: 1.08;
  letter-spacing: -.04em;
  margin-bottom: 10px;
}
.workspace-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 640px;
}
.workspace-trigger {
  white-space: nowrap;
  border-radius: 999px;
  padding: 12px 20px;
}
.chat-workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.chat-message--hidden {
  display: none;
}
.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.choice-chip {
  appearance: none;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s, box-shadow .15s;
}
.choice-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.choice-chip.is-active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,86,219,.08);
}
.composer-shell {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.composer-shell.is-dragging::after {
  content: "松开即可添加附件";
  position: absolute;
  inset: 10px;
  z-index: 20;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 16px;
  background: rgba(239, 244, 255, .94);
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  pointer-events: none;
}
.composer-flow {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f9fbff 0%, #ffffff 100%);
}
.composer-flow-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.composer-flow-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}
.composer-flow-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.composer-shell--locked {
  opacity: .9;
}
.composer-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 18px 0;
}
.composer-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #f6f8fb;
  color: #6b7280;
  font-size: 13px;
}
.composer-meta-pill strong {
  color: var(--accent);
  font-weight: 600;
}
.composer-reset-btn {
  margin-left: auto;
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
}
.composer-reset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.composer-main {
  display: block;
}
.composer-textarea {
  width: 100%;
  min-height: 290px;
  border: none;
  padding: 22px 22px 18px;
  font-size: 16px;
  line-height: 1.75;
  font-family: inherit;
  color: var(--text);
  resize: vertical;
  outline: none;
  background: #fff;
}
.composer-textarea--full {
  min-height: 360px;
}
.composer-shell--locked .composer-textarea {
  background: linear-gradient(180deg, #fbfcfe 0%, #f6f8fb 100%);
  color: #9ca3af;
  cursor: not-allowed;
}
.composer-textarea::placeholder {
  color: #9ca3af;
}
.composer-side-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.composer-hidden-field {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border);
  background: #fbfcfe;
}
.composer-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: auto;
}
.composer-models {
  position: relative;
  margin-left: auto;
}
.composer-submit {
  white-space: nowrap;
  border-radius: 999px;
  padding: 0 22px;
  height: 40px;
  min-width: 116px;
 }
.upload-btn--icon {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 999px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.model-trigger {
  appearance: none;
  border: 1px solid var(--border);
  background: #f3f4f6;
  color: var(--text);
  border-radius: 999px;
  height: 36px;
  padding: 0 14px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.model-trigger:hover {
  border-color: var(--accent);
}
.model-trigger-arrow {
  font-size: 14px;
  color: var(--text-secondary);
}
.model-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 14px 32px rgba(15,23,42,.12);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.model-menu.chat-message--hidden {
  display: none;
}
.model-option {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
}
.model-option:hover {
  background: #f6f8fb;
}
.model-option.is-active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* ---- Form ---- */
.write-form { display: flex; flex-direction: column; gap: 16px; }

/* 上方输入区：移动端单列 */
.form-body { display: flex; flex-direction: column; gap: 16px; }

/* 左栏：移动端打散为 flex 子项 */
.form-left { display: contents; }

/* 底部执行区：移动端竖排 */
.form-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 模型切换提示：固定占位，不允许撑高父容器 */
.model-hint {
  display: block;
  height: 18px;
  line-height: 18px;
  font-size: 12px;
  overflow: hidden;
  margin-top: 4px;
}

.field-group { display: flex; flex-direction: column; gap: 8px; }

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.field-label.required::after {
  content: " *";
  color: var(--danger);
}

.radio-group { display: flex; flex-wrap: wrap; gap: 8px; }

.radio-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13.5px;
  transition: border-color .12s, background .12s, color .12s;
  user-select: none;
  color: var(--text);
}
.radio-item:hover { border-color: var(--accent); color: var(--accent); }
.radio-item input[type="radio"] { display: none; }
.radio-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.textarea-sm {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
.textarea-sm:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(26,86,219,.08);
}

/* 纯文字材料：无格式粘贴 */
.textarea-paste {
  font-family: inherit;
  white-space: pre-wrap;
}

/* 材料第二层：横向双栏 */
.material-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.material-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.material-col-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: .02em;
}
.textarea-link {
  flex: 1;
  resize: vertical;
}

.upload-area {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  flex: 1;
  min-height: 80px;
}
.file-input-hidden { display: none; }
.upload-btn {
  padding: 7px 16px;
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: background .15s;
  white-space: nowrap;
}
.upload-btn:hover { background: #eff4ff; }
.upload-hint { font-size: 13px; color: var(--text-secondary); }
.file-list { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.file-tag {
  font-size: 12px;
  padding: 3px 8px;
  background: #e8f0fe;
  color: #1a56db;
  border-radius: 4px;
}
.input-text {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
}
.input-text:focus { outline: none; border-color: var(--accent); }

/* ---- Buttons ---- */
.btn-primary {
  padding: 11px 32px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, box-shadow .12s;
  align-self: flex-start;
  letter-spacing: .1px;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(26,86,219,.25);
}
.btn-primary:active { box-shadow: none; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  padding: 7px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: border-color .15s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.btn-link:hover { text-decoration: underline; }

/* ---- Result page ---- */
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.result-meta { font-size: 14px; color: var(--text-secondary); }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.result-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.block-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.block-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.block-title-row .block-title { margin-bottom: 0; }

.version-badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  font-weight: 500;
}

.title-list { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.title-list li { font-size: 15px; line-height: 1.5; }

.body-editor {
  width: 100%;
  min-height: 320px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.8;
  font-family: inherit;
  resize: vertical;
  color: var(--text);
  transition: border-color .15s;
}
.body-editor:focus { outline: none; border-color: var(--accent); }

.checklist { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.checklist li { font-size: 14px; line-height: 1.6; }

.status-msg {
  text-align: center;
  padding: 60px 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
#statusText {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.1px;
}
.status-sub {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- Error block (result page) ---- */
.err-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 480px;
  text-align: center;
}
.err-title {
  font-size: 20px;
  font-weight: 700;
  color: #c0392b;
  letter-spacing: -.2px;
}
.err-desc {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}
.err-actions {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  text-align: left;
}
.err-actions-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.err-actions ul {
  margin: 0;
  padding: 0 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.err-actions li {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.err-type {
  font-size: 11px;
  color: var(--text-secondary);
  opacity: .7;
}

/* ---- History page ---- */
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.hist-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.hist-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #f1f3f5;
  color: var(--text-secondary);
}
.tag-type { background: #eff4ff; color: var(--accent); }
.tag-file { background: #f0fdf4; color: #166534; }
.tag-done { background: #f0fdf4; color: #166534; }
.tag-pending { background: #fff7ed; color: #9a3412; }
.hist-time { font-size: 13px; color: var(--text-secondary); }
.hist-outline { font-size: 14px; color: var(--text-secondary); margin-bottom: 10px; }
.hist-actions { display: flex; justify-content: flex-end; }

/* ---- Rules page ---- */
.rules-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.rules-block h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.rules-block ul,
.rules-block ol { padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.rules-block li { font-size: 14px; line-height: 1.6; }
.rules-block p { font-size: 14px; color: var(--text-secondary); margin-bottom: 10px; }
.rules-block--muted { background: #f9fafb; }
.rules-block--muted h2 { color: var(--text-secondary); }
.rules-block--muted p { margin-bottom: 0; }

/* ---- Spinner ---- */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 12px auto 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 稿件思路折叠行 ---- */
/* 整行 button：桌面端当普通 label 用，移动端可点击 */
.outline-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
.outline-row-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.outline-optional { display: none; }   /* 移动端才显示 */
.outline-arrow    { display: none; }   /* 移动端才显示 */

/* outline-body 过渡容器 */
.outline-body {
  overflow: hidden;
  transition: max-height .22s ease, opacity .18s;
  max-height: 400px;
  opacity: 1;
}
.fg-outline.is-collapsed .outline-body {
  max-height: 0;
  opacity: 0;
}

/* ---- 纯文字材料 header ---- */
.paste-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.paste-expand-btn {
  display: none; /* 默认隐藏；移动端 CSS 打开 */
  padding: 2px 10px;
  border: 1.5px solid var(--accent);
  border-radius: 20px;
  background: var(--surface);
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: background .12s;
}
.paste-expand-btn:hover { background: var(--accent-light); }

/* ---- 全屏编辑 overlay ---- */
.paste-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--surface);
  flex-direction: column;
}
.paste-overlay.is-open { display: flex; }
.paste-overlay-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.paste-overlay-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.paste-overlay-done {
  padding: 6px 18px;
  border: none;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}
.paste-overlay-done:hover { background: var(--accent-hover); }
.paste-overlay-ta {
  flex: 1;
  padding: 14px 16px;
  border: none;
  font-size: 15px;
  line-height: 1.7;
  resize: none;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  -webkit-overflow-scrolling: touch;
}

/* ---- Desktop layout (≥768px) ---- */
@media (min-width: 768px) {
  .container {
    max-width: 1040px;
    padding: 44px 40px 80px;
  }
  .nav { height: 52px; padding: 0 32px; }
  .nav-brand { font-size: 19px; }
  .page-title { font-size: 24px; margin-bottom: 28px; }

  /* 上方输入区：左右两栏等高拉伸 */
  .form-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: stretch;   /* 左右等高 */
  }

  /* 左栏：配置卡片，内部纵向伸展 */
  .form-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 22px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
  }
  /* 稿件思路 flex 填满剩余空间，让左右卡片底部对齐 */
  .fg-outline {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  /* outline-body：桌面端解除折叠动画限制，参与 flex 拉伸 */
  .fg-outline .outline-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-height: none;
    overflow: visible;
    opacity: 1;
  }
  .fg-outline .textarea-sm {
    flex: 1;
    min-height: 120px;
    resize: vertical;
  }

  /* 右栏：材料卡片 */
  .fg-material {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 22px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    gap: 14px;
  }

  /* 底部执行区：横排，模型左 + 按钮右 */
  .form-footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 22px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
  }
  .fg-model {
    flex: 1;
    gap: 6px;
  }
  .fg-model .field-label { margin-bottom: 0; }

  /* 写稿按钮：执行区右侧，固定尺寸不随状态变化 */
  .btn-primary {
    flex-shrink: 0;
    align-self: center;
    padding: 0 36px;
    height: 42px;
    font-size: 15px;
    border-radius: 10px;
    width: auto;
  }

  /* 统一胶囊控件语言（桌面端）：领域 / 稿型 / 模型 */
  .radio-item {
    padding: 7px 16px;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 20px;   /* 椭圆胶囊 */
  }
  .radio-item:has(input:checked) {
    font-weight: 600;
    box-shadow: 0 0 0 3px rgba(26,86,219,.1);
  }
  .radio-group { gap: 8px; }

  /* 模型按钮降一档：更小更克制 */
  .fg-model .radio-item {
    padding: 5px 13px;
    font-size: 12.5px;
    font-weight: 400;
  }
  .fg-model .radio-item:has(input:checked) { font-weight: 600; }

  /* Field labels */
  .field-label { font-size: 11px; letter-spacing: .07em; }
  .outline-row-label { font-size: 11px; letter-spacing: .07em; }

  /* 文字材料区高度 */
  .textarea-paste { min-height: 120px; }

  /* 材料区桌面端：三块竖排 */
  .material-row {
    flex-direction: column;
    gap: 14px;
  }
  .material-col { flex: none; }

  /* 上传区横向展开 */
  .upload-area {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    min-height: auto;
    padding: 11px 14px;
    gap: 10px;
  }
}

/* ---- Mobile (≤600px) ---- */
@media (max-width: 600px) {
  /* 顶部区域收紧 */
  .nav {
    padding: 10px 14px;
    height: auto;
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .nav-links { gap: 14px; flex-wrap: wrap; }
  .nav-user-bar { width: 100%; justify-content: flex-end; }
  .container { padding: 8px 14px 40px; }
  .page-title { font-size: 15px; margin-bottom: 8px; letter-spacing: -.1px; }
  .page-title span { font-size: 10px !important; padding: 1px 5px !important; }
  .admin-form { grid-template-columns: 1fr; }
  .admin-user-head { flex-direction: column; }
  .workspace-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
    border-radius: 16px;
  }
  .workspace-title {
    font-size: 28px;
  }
  .workspace-subtitle {
    font-size: 14px;
  }
  .workspace-trigger {
    width: 100%;
    height: 42px;
    text-align: center;
  }
  .choice-grid {
    gap: 8px;
  }
  .choice-chip {
    padding: 8px 13px;
    font-size: 13px;
  }
  .composer-shell {
    border-radius: 18px;
  }
  .composer-flow {
    padding: 14px 14px 10px;
  }
  .composer-meta-row {
    padding: 14px 14px 0;
    gap: 8px;
  }
  .composer-meta-pill {
    font-size: 12px;
    padding: 6px 10px;
  }
  .composer-reset-btn {
    margin-left: 0;
  }
  .composer-main {
    grid-template-columns: 1fr;
  }
  .composer-textarea {
    min-height: 250px;
    padding: 16px 16px 14px;
    font-size: 15px;
  }
  .composer-textarea--full {
    min-height: 280px;
  }
  .composer-toolbar {
    gap: 10px;
    padding: 12px;
    flex-wrap: wrap;
  }
  .composer-models,
  .composer-upload {
    width: auto;
  }
  .composer-models {
    margin-left: 0;
  }
  .model-menu {
    right: auto;
    left: 0;
  }
  .composer-submit {
    margin-left: auto;
    height: 42px;
  }

  .result-header { flex-direction: column; align-items: flex-start; }
  .write-form { gap: 12px; }
  .field-group { gap: 6px; }
  .textarea-sm { font-size: 14px; }
  .upload-area { padding: 10px 12px; gap: 8px; min-height: 60px; }
  .radio-group { gap: 6px; }
  .radio-item { padding: 5px 11px; font-size: 13px; }

  /* 稿件思路：整行折叠条（移动端激活） */
  .outline-toggle-row { cursor: pointer; }
  .outline-optional {
    display: inline;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 11px;
    margin-left: 3px;
    opacity: 0.6;
  }
  .outline-arrow {
    display: inline-block;
    font-size: 15px;
    color: var(--text-secondary);
    opacity: 0.35;
    transition: transform .2s ease;
    flex-shrink: 0;
  }
  .fg-outline:not(.is-collapsed) .outline-arrow { transform: rotate(90deg); }

  /* 全屏编辑：轻量文字动作，和标签长在一起 */
  .paste-expand-btn {
    display: inline-block;
    border: none;
    background: none;
    color: var(--accent);
    font-size: 12px;
    padding: 0;
    opacity: 0.65;
    cursor: pointer;
  }
  .paste-expand-btn:hover { opacity: 1; }

  /* 纯文字材料框：紧凑固定高度 */
  .textarea-paste {
    max-height: 64px;
    overflow-y: auto;
    resize: none;
    -webkit-overflow-scrolling: touch;
  }

  /* 模型胶囊：再降一档 */
  .fg-model .radio-item { padding: 3px 9px; font-size: 11.5px; }

  /* 模型状态提示：贴着胶囊的注脚，不独立成行 */
  .model-hint {
    font-size: 11px;
    height: 14px;
    line-height: 14px;
    margin-top: 2px;
    color: #9ca3af;
  }

  /* 执行区：收紧间距 */
  .form-footer { gap: 8px; }

  /* 写稿按钮：像按钮，不像横条 */
  .btn-primary {
    width: calc(100% - 32px);
    margin: 0 16px;
    text-align: center;
    height: 40px;
    font-size: 14px;
    border-radius: 10px;
  }
}
