:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-muted: #f0f3f7;
  --text: #172033;
  --muted: #657085;
  --line: #d8dee8;
  --brand: #0f766e;
  --brand-strong: #0b5c57;
  --accent: #c2410c;
  --shadow: 0 18px 45px rgba(24, 35, 58, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
textarea,
select,
input {
  font: inherit;
}

button:disabled,
textarea:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #101722;
  color: #eef3f8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  font-weight: 800;
}

.brand-name {
  font-weight: 700;
}

.brand-subtitle {
  color: #a7b1c2;
  font-size: 12px;
}

.new-task-button,
.send-button {
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
  font-weight: 700;
}

.new-task-button {
  height: 40px;
}

.feature-nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
}

.nav-group-title {
  margin: 0 0 8px;
  color: #8fa0b7;
  font-size: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  color: #dbe5ef;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.08);
}

.workspace {
  min-width: 0;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  font-size: 24px;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.user-chip,
.tool-button,
.secondary-button,
.danger-button,
.auth-banner button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.icon-button {
  width: 40px;
  height: 40px;
}

.user-chip {
  min-height: 40px;
  padding: 0 14px;
}

.secondary-button,
.danger-button,
.auth-banner button {
  min-height: 40px;
  padding: 0 14px;
}

.danger-button {
  border-color: #dc2626;
  color: #fff;
  background: #dc2626;
}

.auth-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #f5c46b;
  border-radius: 8px;
  background: #fff8e8;
  color: #6f4500;
}

.auth-banner[hidden],
.chat-layout[hidden],
.state-panel[hidden] {
  display: none;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #eef7f5 100%);
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-copy h2 {
  margin: 8px 0;
  font-size: 28px;
}

.hero-copy p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.quick-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.quick-metrics div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.quick-metrics strong {
  display: block;
  font-size: 24px;
}

.quick-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  min-height: 560px;
}

.conversation-panel,
.context-panel,
.state-panel,
.home-dashboard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.state-panel {
  margin-bottom: 18px;
  padding: 24px;
}

.state-panel h2,
.state-panel p {
  margin: 0;
}

.state-panel p {
  margin-top: 8px;
  color: var(--muted);
}

.home-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  margin-bottom: 18px;
  padding: 16px;
}

.home-dashboard[hidden] {
  display: none;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 16px;
}

.section-heading span {
  color: var(--muted);
  font-size: 12px;
}

.feature-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.feature-card,
.recent-usage-card,
.dashboard-empty {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.feature-card,
.recent-usage-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
}

.feature-card:hover,
.recent-usage-card:hover {
  border-color: var(--brand);
}

.feature-card span,
.feature-card small,
.recent-usage-card span,
.dashboard-empty {
  color: var(--muted);
  font-size: 12px;
}

.feature-card strong,
.recent-usage-card strong {
  overflow-wrap: anywhere;
}

.recent-usage-cards {
  display: grid;
  gap: 10px;
}

.dashboard-empty {
  padding: 12px;
}

.conversation-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 420px;
  padding: 18px;
  overflow: auto;
}

.message {
  max-width: 78%;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.6;
}

.message.assistant {
  align-self: flex-start;
  background: var(--panel-muted);
}

.message.user {
  align-self: flex-end;
  color: #fff;
  background: var(--brand);
}

.workflow-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.copywriting-panel,
.copywriting-check-panel,
.customer-service-panel,
.video-creation-panel,
.statistics-panel,
.system-config-panel,
.product-design-panel,
.image-process-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.copywriting-panel[hidden],
.copywriting-check-panel[hidden],
.customer-service-panel[hidden],
.video-creation-panel[hidden],
.statistics-panel[hidden],
.system-config-panel[hidden],
.product-design-panel[hidden],
.image-process-panel[hidden] {
  display: none;
}

.copywriting-grid,
.copywriting-check-grid,
.customer-service-grid,
.video-creation-grid,
.statistics-grid,
.system-config-grid,
.product-design-grid,
.image-process-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.copywriting-controls,
.copywriting-check-controls,
.customer-service-controls,
.video-creation-controls,
.customer-recognition-result,
.customer-reply-version-list,
.customer-history-list,
.video-script-result,
.video-history-list,
.statistics-list,
.system-config-list,
.copywriting-check-report,
.copywriting-check-history,
.copy-version-list,
.copy-history-list,
.image-process-controls,
.product-material-editor,
.product-material-list,
.product-history-list,
.image-history-list,
.product-empty {
  min-width: 0;
}

.copywriting-controls,
.copywriting-check-controls,
.customer-service-controls,
.video-creation-controls,
.copy-check-card,
.customer-recognition-card,
.customer-reply-version-item,
.customer-history-item,
.video-script-card,
.video-history-item,
.statistics-item,
.system-config-item,
.copy-version-item,
.copy-history-item,
.copy-empty,
.customer-empty,
.video-empty,
.statistics-empty,
.system-config-empty,
.image-process-controls,
.image-compare > div,
.image-history-item,
.image-empty,
.product-material-editor,
.product-material-item,
.product-history-item,
.product-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-material-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.image-process-controls,
.copywriting-controls,
.copywriting-check-controls,
.customer-service-controls,
.video-creation-controls,
.image-compare > div {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px;
}

.image-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.product-material-editor input[type="text"],
.statistics-controls input,
.system-config-form input,
.system-config-form textarea,
.history-search {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-version-list,
.customer-reply-version-list,
.customer-history-list,
.video-history-list,
.statistics-list,
.system-config-list,
.copywriting-check-history,
.copy-history-list,
.product-material-list,
.image-history-list,
.product-history-list {
  display: grid;
  gap: 8px;
}

.copy-version-item,
.customer-reply-version-item,
.product-material-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 10px;
  color: var(--text);
  cursor: pointer;
}

.copy-check-card {
  display: grid;
  gap: 8px;
}

.copy-check-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.video-script-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.statistics-controls {
  display: grid;
  grid-template-columns: minmax(180px, 240px) auto;
  gap: 10px;
  align-items: end;
}

.statistics-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.statistics-summary div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.statistics-summary strong {
  display: block;
  font-size: 20px;
}

.statistics-summary span {
  color: var(--muted);
  font-size: 12px;
}

.system-config-form {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.system-config-form h2 {
  margin: 0;
  font-size: 16px;
}

.system-config-form textarea {
  min-height: 92px;
  padding: 10px;
  resize: vertical;
}

.system-config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.product-material-item strong,
.copy-check-card strong,
.customer-recognition-card strong,
.customer-reply-version-item strong,
.customer-history-item strong,
.video-script-card strong,
.video-history-item strong,
.statistics-item strong,
.system-config-item strong,
.copy-version-item strong,
.copy-history-item strong,
.product-history-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.copy-version-item span,
.customer-recognition-card span,
.customer-reply-version-item span,
.customer-history-item span,
.video-script-card span,
.video-history-item span,
.statistics-item span,
.system-config-item span,
.copy-check-card span,
.copy-history-item span,
.product-material-item small,
.image-history-item span,
.image-compare span,
.product-history-item span,
.product-empty,
.image-empty {
  color: var(--muted);
  font-size: 12px;
}

.copy-history-item,
.customer-recognition-card,
.customer-history-item,
.video-script-card,
.video-history-item,
.statistics-item,
.system-config-item,
.copy-check-card,
.copy-empty,
.customer-empty,
.video-empty,
.statistics-empty,
.system-config-empty,
.image-history-item,
.image-empty,
.product-history-item,
.product-empty {
  padding: 10px;
}

.copy-version-item,
.customer-reply-version-item,
.copy-history-item,
.customer-history-item,
.video-history-item,
.statistics-item,
.system-config-item,
.image-history-item,
.product-history-item {
  cursor: pointer;
}

.copy-version-item.active,
.customer-reply-version-item.active,
.customer-reply-version-item:hover,
.customer-history-item:hover,
.video-history-item:hover,
.statistics-item:hover,
.system-config-item:hover,
.image-history-item:hover,
.copy-history-item:hover,
.copy-version-item:hover,
.product-history-item:hover,
.product-material-item:hover {
  border-color: var(--brand);
}

.section-heading.compact {
  margin-bottom: 8px;
}

.upload-panel,
.result-state {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.upload-panel p,
.result-state span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.upload-status {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-muted);
  font-size: 13px;
}

.upload-status.ready,
.result-state.success {
  border-color: #9ad6ba;
  background: #ecfdf5;
}

.upload-status.failed,
.result-state.failed {
  border-color: #f5b1b1;
  background: #fff1f2;
}

.result-state.loading {
  border-color: #adc8ff;
  background: #eff6ff;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.tool-button {
  height: 42px;
  font-size: 20px;
}

textarea {
  width: 100%;
  min-height: 42px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.send-button {
  min-height: 42px;
}

.context-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px;
}

.context-panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.health-card,
.recent-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-muted);
}

.recent-list {
  display: grid;
  gap: 10px;
}

.history-section {
  min-width: 0;
}

.history-search {
  margin-bottom: 10px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item,
.history-empty,
.recent-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-muted);
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.history-item strong,
.recent-item strong {
  display: block;
  margin-bottom: 4px;
}

.history-item span,
.recent-item span,
.history-empty {
  color: var(--muted);
  font-size: 12px;
}

.history-row-actions,
.history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-row-actions button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.history-actions {
  justify-content: space-between;
  margin-top: 10px;
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 18, 28, 0.42);
  z-index: 10;
}

.confirm-backdrop[hidden] {
  display: none;
}

.confirm-dialog {
  width: min(420px, 100%);
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.confirm-dialog h2,
.confirm-dialog p {
  margin: 0;
}

.confirm-dialog p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .hero-panel,
  .chat-layout,
  .home-dashboard,
  .workflow-panel,
  .customer-service-grid,
  .video-creation-grid,
  .statistics-grid,
  .statistics-summary,
  .statistics-controls,
  .system-config-grid,
  .image-process-grid,
  .image-compare,
  .product-design-grid {
    grid-template-columns: 1fr;
  }

  .feature-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 14px;
  }

  .topbar,
  .quick-metrics {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .auth-banner {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .topbar-actions > * {
    width: 100%;
  }

  .message {
    max-width: 100%;
  }

  .history-item,
  .confirm-actions {
    grid-template-columns: 1fr;
  }

  .feature-card-grid {
    grid-template-columns: 1fr;
  }

  .history-row-actions,
  .confirm-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
.copy-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.copy-version-item {
  width: 100%;
  text-align: left;
}
