:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #243129;
  background: #f4f6f2;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
p, h1, h2, h3 { margin-top: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 78px; gap: 20px; padding: 14px 28px; border-bottom: 1px solid #dce4db; background: #fff; }
.brand, .topbar-actions, .composer-footer, .review-heading, .chat-heading, .guide-heading { display: flex; align-items: center; }
.brand { gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #284834; color: #fff; font-size: 22px; font-weight: 700; }
.eyebrow { margin: 0 0 3px; color: #758c7a; font-size: 11px; font-weight: 700; letter-spacing: .09em; }
h1 { margin: 0; font-size: 18px; }
h2 { margin: 0; font-size: 18px; }
h3 { margin-bottom: 10px; font-size: 14px; }
.topbar-actions { gap: 16px; }
.flow-steps { display: flex; align-items: center; gap: 6px; }
.flow-step { border-radius: 999px; padding: 7px 11px; color: #87948a; font-size: 12px; font-weight: 700; }
.flow-step.active { background: #e9f5e7; color: #326d42; }
.local-badge { border-radius: 999px; padding: 6px 10px; background: #ecf4ec; color: #447550; font-size: 12px; }
.quiet-button, .text-button { border: 0; background: transparent; color: #326d42; font-size: 13px; font-weight: 700; }
.quiet-button { padding: 8px; }
.quiet-button.active { border-radius: 8px; background: #e9f5e7; }
.text-button { padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.notice { margin: 12px 20px 0; border: 1px solid #e2bd7f; border-radius: 10px; padding: 11px 14px; background: #fff5df; color: #755421; font-size: 13px; line-height: 1.5; }

.workspace { min-height: calc(100vh - 78px); }
.flow-page { max-width: 1500px; min-height: calc(100vh - 78px); margin: auto; }
.chat-page { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); }
.review-page { padding: 22px 28px 38px; }
.history-page { max-width: 1100px; padding: 28px 28px 48px; }
.history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.history-heading h2 { margin-bottom: 7px; font-size: 23px; }
.history-heading p:last-child { margin: 0; color: #6e7e71; font-size: 13px; line-height: 1.6; }
.history-list { display: grid; gap: 12px; }
.history-record { border: 1px solid #dce5da; border-radius: 14px; background: #fff; overflow: hidden; }
.history-record-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; cursor: pointer; }
.history-record-heading::marker { color: #6c9875; }
.history-record-identity { display: flex; flex-direction: column; gap: 4px; }
.history-record-identity strong { color: #2a3f2e; font-size: 14px; }
.history-record-identity span { color: #829085; font-size: 12px; }
.history-record-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.history-status { display: inline-flex; border-radius: 999px; padding: 4px 8px; background: #eaf5eb; color: #3c7449; font-size: 11px; font-weight: 700; white-space: nowrap; }
.history-status.warning { background: #fff0d6; color: #8c6423; }
.history-record-content { border-top: 1px solid #edf1eb; padding: 15px 18px 5px; }
.history-record-content > .footnote { margin: 0 0 13px; }
.history-load-more { display: block; margin: 19px auto 0; }
.review-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 15px; color: #718075; font-size: 12px; }
.guide-panel, .chat-panel, .review-panel { min-width: 0; padding: 25px; }
.guide-panel { border-right: 1px solid #dce4db; background: #f9fbf8; }
.panel-title { margin-bottom: 18px; }
.guide-copy { color: #5b6a60; font-size: 13px; line-height: 1.65; }
.template-download, .message-download { display: inline-block; border: 1px solid #b9d2bb; border-radius: 9px; padding: 9px 11px; background: #fff; color: #326d42; font-size: 12px; font-weight: 700; text-decoration: none; }
.template-download { margin: -5px 0 18px; }
.template-note { margin: -13px 0 18px; color: #78877c; font-size: 11px; line-height: 1.5; }
.template-download:hover, .message-download:hover { background: #eff7ee; }
.message-download { margin-top: 10px; }
.guide-example { margin: 20px 0 26px; border: 1px solid #d9e7d8; border-radius: 14px; padding: 14px; background: #eff7ee; }
.small-label { margin-bottom: 7px; color: #617c65; font-size: 11px; font-weight: 700; }
.guide-example p:nth-child(2) { margin-bottom: 10px; font-size: 12px; line-height: 1.6; }
.guide-heading { align-items: flex-end; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.guide-heading h3 { margin: 0; }
.guide-heading span { color: #87948a; font-size: 11px; }
.template-list { display: grid; gap: 7px; }
.template-card { width: 100%; border: 1px solid #dce5db; border-radius: 11px; padding: 10px 11px; background: #fff; text-align: left; }
.template-card:hover, .template-card.selected { border-color: #82aa84; background: #eff7ee; }
.template-card strong { display: block; margin-bottom: 4px; font-size: 12px; }
.template-card small { display: block; color: #708074; font-size: 11px; line-height: 1.45; }
.categories-box { margin-top: 25px; border-top: 1px solid #dce4db; padding-top: 19px; }
.categories-box p { margin: 0; color: #617166; font-size: 12px; line-height: 1.7; word-break: break-word; }

.chat-panel { display: flex; flex-direction: column; gap: 18px; min-height: calc(100vh - 78px); background: #fff; }
.chat-heading, .review-heading { justify-content: space-between; gap: 12px; }
.chat-heading-actions { display: flex; align-items: center; gap: 10px; }
.state-pill { flex: 0 0 auto; border-radius: 999px; padding: 6px 9px; background: #edf0ec; color: #667267; font-size: 11px; font-weight: 700; }
.state-pill.ready { background: #e9f5e7; color: #397847; }
.state-pill.warning { background: #fff1d7; color: #9b6a24; }
.state-pill.error { background: #fbe8e4; color: #9e4d41; }
.messages { flex: 1; overflow: auto; max-height: calc(100vh - 355px); min-height: 240px; padding: 8px 4px 12px; }
.message { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 16px; }
.message.user { justify-content: flex-end; }
.avatar { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border-radius: 9px; background: #e2eee0; color: #3f6946; font-size: 10px; font-weight: 800; }
.bubble { max-width: 88%; border: 1px solid #e1e7df; border-radius: 3px 13px 13px; padding: 11px 13px; background: #f9fbf8; font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.user .bubble { border: 0; border-radius: 13px 3px 13px 13px; background: #294935; color: #fff; }
.composer { flex: 0 0 auto; border: 1px solid #d7e3d7; border-radius: 14px; padding: 12px; background: #fff; box-shadow: 0 9px 25px #314e3210; }
.selected-template, .selected-file { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; border-radius: 8px; padding: 6px 9px; background: #ecf4e9; color: #3a6743; font-size: 12px; }
.selected-file { background: #eef3f7; color: #3f5d76; }
.selected-template button, .selected-file button { border: 0; background: transparent; color: inherit; font-size: 12px; font-weight: 700; }
textarea { display: block; width: 100%; min-height: 106px; border: 0; outline: 0; resize: vertical; color: #243129; font-size: 13px; line-height: 1.6; }
textarea::placeholder { color: #97a398; }
.composer-footer { gap: 9px; justify-content: space-between; }
.upload-button, .secondary-button { border: 1px solid #c6d7c7; border-radius: 9px; padding: 9px 11px; background: #fff; color: #386648; font-size: 12px; font-weight: 700; }
.upload-button { cursor: pointer; white-space: nowrap; }
.composer-help { flex: 1; color: #91a096; font-size: 11px; }
.primary-button { border: 0; border-radius: 9px; padding: 10px 14px; background: #294935; color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; }
.primary-button:not(:disabled):hover { background: #1d3928; }

.review-panel { display: flex; flex-direction: column; gap: 16px; min-height: calc(100vh - 180px); border: 1px solid #dce4db; border-radius: 16px; background: #f9fbf8; }
.review-content { flex: 1; min-height: 180px; }
.empty-state { border: 1px dashed #cdd9cc; border-radius: 14px; padding: 34px 22px; color: #839187; text-align: center; font-size: 12px; line-height: 1.6; }
.empty-state span { display: grid; place-items: center; width: 34px; height: 34px; margin: auto auto 11px; border-radius: 10px; background: #e8f0e7; color: #5e8465; font-size: 20px; }
.empty-state p { margin-bottom: 0; }
.review-summary { margin-bottom: 14px; border: 1px solid #dce5da; border-radius: 11px; padding: 11px 13px; background: #fff; font-size: 12px; line-height: 1.6; }
.review-summary strong { font-size: 14px; }
.submission-history { margin-top: 20px; }
.submission-history h3 { margin: 0 0 9px; color: #526659; }
.history-batch summary { background: #f4faf3; font-size: 11px; font-weight: 600; }
.history-product-list { margin: 0; padding: 0 16px 12px 30px; color: #435648; font-size: 12px; line-height: 1.7; }
.issue-box { margin: 0 0 12px; border: 1px solid #e9cf9b; border-radius: 10px; padding: 10px 12px; background: #fff7e8; color: #805a28; font-size: 12px; line-height: 1.55; }
.issue-box.error { border-color: #e9b8b0; background: #fff0ed; color: #974b42; }
.issue-box ul { margin: 7px 0 0; padding-left: 18px; }
.product-card { margin-bottom: 9px; border: 1px solid #dce5da; border-radius: 11px; background: #fff; overflow: hidden; }
.product-card.history-card { border-color: #c9d9ca; }
.history-card summary { background: #f4faf3; }
.product-card summary { cursor: pointer; padding: 12px; font-size: 13px; font-weight: 700; line-height: 1.5; }
.product-card summary::marker { color: #6c9875; }
.product-card summary small { display: block; margin-top: 3px; margin-left: 17px; color: #728278; font-size: 11px; font-weight: 400; }
.product-fields { margin: 0; padding: 0 12px 10px; }
.product-fields div { border-top: 1px solid #edf1eb; padding: 8px 0; }
.product-fields dt { margin-bottom: 3px; color: #819085; font-size: 11px; }
.product-fields dd { margin: 0; color: #2f3e32; font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-actions { position: sticky; bottom: 0; z-index: 2; border-top: 1px solid #dce4db; padding: 13px 0 0; background: #f9fbf8; box-shadow: 0 -9px 20px #2949350a; }
.submission-feedback { position: relative; margin-bottom: 12px; border: 1px solid #c8dcca; border-radius: 10px; padding: 11px 12px 11px 36px; background: #eef8ed; color: #356744; font-size: 12px; line-height: 1.55; }
.submission-feedback::before { content: "✓"; position: absolute; top: 10px; left: 12px; display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: #4c8a57; color: #fff; font-size: 11px; font-weight: 800; }
.submission-feedback.progress { border-color: #b9d1e4; background: #eef6fc; color: #315d7b; }
.submission-feedback.progress::before { content: ""; border: 2px solid #a9c4d9; border-top-color: #2c6d9b; background: transparent; animation: submission-spin .8s linear infinite; }
.submission-feedback.warning { border-color: #e9cf9b; background: #fff7e8; color: #805a28; }
.submission-feedback.warning::before { content: "!"; background: #bd8735; }
.submission-feedback.error { border-color: #e9b8b0; background: #fff0ed; color: #974b42; }
.submission-feedback.error::before { content: "×"; background: #b45449; }
@keyframes submission-spin { to { transform: rotate(360deg); } }
.confirmation-label { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; color: #435648; font-size: 12px; line-height: 1.5; }
.confirmation-label input { margin: 2px 0 0; accent-color: #2c6b3e; }
.confirm-button, .review-actions .secondary-button { display: block; width: 100%; min-height: 43px; font-size: 14px; }
.confirm-button[aria-busy="true"] { opacity: 1; cursor: wait; background: #527a5d; }
.confirm-button[aria-busy="true"]::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 7px; vertical-align: -2px; border: 2px solid #c9dfce; border-top-color: #fff; border-radius: 50%; animation: submission-spin .8s linear infinite; }
.review-actions .secondary-button { margin-top: 8px; }
.footnote { margin: 10px 0 0; color: #859189; font-size: 11px; line-height: 1.55; }
.result-box { border: 1px solid #cce1cc; border-radius: 10px; padding: 11px; background: #f0f8ef; color: #3e6744; font-size: 12px; line-height: 1.6; }
.result-box.warning { border-color: #e9cf9b; background: #fff7e8; color: #805a28; }
.preserved-settings { margin: 0 12px 12px; border: 1px solid #d8c99e; border-radius: 9px; padding: 10px; background: #fffaf0; font-size: 12px; }
.preserved-settings strong { display: block; color: #6c542d; }
.preserved-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; color: #526356; }
.preserved-field select, .preserved-field input { min-width: 126px; max-width: 45%; border: 1px solid #cad6ca; border-radius: 7px; padding: 7px; background: #fff; color: #273b2d; font: inherit; }
.server-preview { margin: 18px 0; border: 1px solid #bed3c3; border-radius: 12px; padding: 12px; background: #f3faf4; }
.server-preview h3 { margin: 0; color: #315f3a; font-size: 14px; }
.server-operation { margin-top: 10px; border: 1px solid #d5e3d7; border-radius: 9px; background: #fff; }
.server-operation > summary { cursor: pointer; padding: 10px; color: #315f3a; font-size: 12px; font-weight: 700; }
.server-operation > .footnote { margin: 0 10px 10px; overflow-wrap: anywhere; }
.server-preview-item { margin: 0 10px 10px; border-top: 1px solid #edf1eb; padding-top: 10px; font-size: 12px; }
.server-preview-item > strong { display: block; margin-bottom: 7px; }
.batch-counts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.batch-counts span, .batch-action-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.batch-counts .create, .batch-action-pill.create { background: #e8f4e7; color: #326b3d; }
.batch-counts .update, .batch-action-pill.update { background: #e8f0fb; color: #365f91; }
.batch-counts .unchanged, .batch-action-pill.unchanged { background: #eef0ed; color: #647166; }
.batch-counts .needs-attention, .batch-action-pill.needs_attention { background: #fff0d6; color: #8c6423; }
.review-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 5px 0 18px; }
.review-filter { border: 1px solid #d5e1d5; border-radius: 999px; padding: 7px 13px; background: #fff; color: #5f7163; font-size: 12px; font-weight: 700; }
.review-filter.selected { border-color: #6f9d76; background: #e9f5e7; color: #326d42; }
.review-filter-note { color: #87958a; font-size: 11px; }
.review-product-card { margin: 0 0 13px; border: 1px solid #dce5da; border-radius: 13px; background: #fff; overflow: hidden; }
.review-product-card.action-update { border-left: 4px solid #6c97c7; }
.review-product-card.action-create { border-left: 4px solid #70aa78; }
.review-product-card.action-needs_attention { border-left: 4px solid #cfa156; }
.review-product-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 16px 18px 13px; }
.review-product-identity h3 { margin: 8px 0 3px; color: #26392b; font-size: 16px; }
.review-product-meta { margin: 0; color: #7c8a7e; font-size: 12px; }
.review-select { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; border: 1px solid #d5e4d4; border-radius: 8px; padding: 8px 10px; color: #3b6843; font-size: 12px; font-weight: 700; }
.review-select input { width: 16px; height: 16px; margin: 0; accent-color: #326d42; }
.review-card-body { border-top: 1px solid #edf1eb; padding: 15px 18px 18px; overflow-x: auto; }
.review-comparison-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; line-height: 1.6; }
.review-comparison-table th, .review-comparison-table td { padding: 11px 12px; border-bottom: 1px solid #edf1eb; text-align: left; vertical-align: top; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-comparison-table thead th { background: #f4f7f3; color: #627467; font-size: 12px; }
.review-comparison-table tbody th { width: 23%; color: #3b5141; }
.review-comparison-table .review-target { color: #23663a; font-weight: 700; background: #f5fbf5; }
.review-empty-change { margin: 8px 18px 16px; color: #718075; font-size: 13px; }
.review-create-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 26px; margin: 0; }
.review-create-fields > div { border-bottom: 1px solid #edf1eb; padding: 9px 0; }
.review-create-fields > div:nth-child(4), .review-create-fields > div:nth-child(5), .review-create-fields > div:nth-child(7) { grid-column: 1 / -1; }
.review-create-fields dt { margin-bottom: 4px; color: #849087; font-size: 11px; }
.review-create-fields dd { margin: 0; color: #2e4033; font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-product-card > .issue-box, .review-card-body > .issue-box { margin: 0 18px 16px; }
.review-card-body > .issue-box { margin: 14px 0 0; }
.review-card-body > .footnote { margin-top: 14px; }
.image-reminder { margin: 14px 0 0; border-radius: 8px; padding: 10px 12px; background: #fff7e8; color: #805a28; font-size: 12px; }

@media (max-width: 950px) {
  .chat-page { grid-template-columns: minmax(210px, 260px) minmax(0, 1fr); }
  .topbar-actions { gap: 8px; }
}
@media (max-width: 760px) {
  .topbar { padding: 12px 16px; }
  .local-badge { display: none; }
  .flow-steps { display: none; }
  .chat-page { display: flex; flex-direction: column; }
  .chat-panel { order: 1; height: calc(100vh - 78px); min-height: 520px; padding: 20px 16px; }
  .guide-panel { order: 2; border-top: 1px solid #dce4db; border-right: 0; padding: 20px 16px; }
  .messages { min-height: 0; max-height: none; overflow: auto; }
  .chat-heading-actions { flex-wrap: wrap; justify-content: flex-end; }
  .review-page { padding: 12px; }
  .history-page { padding: 20px 12px; }
  .history-heading, .history-record-heading { flex-wrap: wrap; }
  .review-topbar { flex-wrap: wrap; }
  .review-panel { padding: 18px 14px; }
  .review-product-header { flex-wrap: wrap; padding: 13px; }
  .review-card-body { padding: 12px; }
  .review-comparison-table { min-width: 560px; }
  .review-create-fields { grid-template-columns: 1fr; }
  .review-create-fields > div:nth-child(4), .review-create-fields > div:nth-child(5), .review-create-fields > div:nth-child(7) { grid-column: auto; }
}
