:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #dedee3;
  --accent: #ff4f1f;
  --accent-2: #ff7a59;
  --blue: #0071e3;
  --green: #36b37e;
  --yellow: #ffd60a;
  --pink: #ff78a7;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
  overflow: hidden;
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 36px;
  align-items: center;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 56px;
}

.login-panel h1,
.topbar h1 {
  margin: 0;
  font-size: 54px;
  line-height: 1.05;
}

.brand-title span {
  display: inline-block;
  margin-left: 10px;
  color: var(--accent);
  font-size: 0.42em;
  font-weight: 900;
  vertical-align: baseline;
}

.login-name-accent {
  color: var(--accent);
}

.wechat-copy {
  display: inline-flex;
  width: fit-content;
  margin-top: 14px;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font-weight: 900;
  line-height: 1.6;
  text-align: left;
}

.wechat-copy:hover {
  color: #e84416;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.accent {
  color: var(--accent);
}

.subtle {
  color: var(--muted);
  margin: 0;
  line-height: 1.7;
}

.login-form,
.tool-panel,
.main-panel,
.chat-panel,
.idea-panel,
.admin-panel {
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  gap: 18px;
  padding: 26px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.7;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.primary,
.ghost,
.danger-light {
  min-height: 44px;
  border-radius: 8px;
  border: 0;
  padding: 0 18px;
  font-weight: 800;
  white-space: nowrap;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: #e84416;
}

.ghost {
  background: #e9e9ed;
  color: var(--text);
}

.danger-light {
  background: #fff0ec;
  color: #c73511;
}

.wide {
  width: 100%;
}

.error-text {
  min-height: 22px;
  color: #c73511;
  font-weight: 700;
  margin: 0;
}

.app-shell {
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 28px 38px 70px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 18px;
}

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

#userBadge {
  background: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.tabs {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 14px 0 30px;
}

.tab {
  min-height: 58px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  padding: 0 26px;
  background: #fff;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.tab:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.09);
}

.tab.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 16px 36px rgba(255, 79, 31, 0.24);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-band {
  position: relative;
  min-height: 218px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  overflow: hidden;
  padding: 40px 46px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.hero-band h2,
.section-title h2,
.chat-panel h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.2;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 10px;
  min-width: 340px;
}

.summary-strip span,
.admin-stats span {
  display: grid;
  gap: 4px;
  background: #f5f5f7;
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  font-weight: 700;
}

.summary-strip strong,
.admin-stats strong {
  color: var(--text);
  font-size: 26px;
}

.workbench {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

.tool-panel,
.main-panel,
.chat-panel,
.idea-panel,
.admin-panel {
  padding: 24px;
}

.field-head {
  margin: 0 0 12px;
}

.field-head h3,
.admin-panel h3,
.idea-panel h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.field-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 8px;
  margin-bottom: 24px;
}

.segmented button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f5f7;
  color: var(--text);
  font-weight: 800;
}

.segmented button.active {
  border-color: var(--accent);
  background: #fff0ec;
  color: var(--accent);
}

.segmented button:disabled {
  cursor: not-allowed;
  opacity: 0.66;
}

.select-field,
.range-field,
.prompt-box {
  margin-top: 18px;
}

.range-field span,
.select-field span,
.prompt-box span {
  display: flex;
  justify-content: space-between;
  color: var(--text);
}

input[type="range"] {
  accent-color: var(--accent);
  padding: 0;
  border: 0;
}

.upload-zone {
  min-height: 178px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 6px;
  border: 2px dashed #cfd0d6;
  border-radius: 8px;
  background: #fbfbfd;
  padding: 24px;
  color: var(--muted);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.upload-zone.dragging {
  border-color: var(--accent);
  background: #fff0ec;
  transform: translateY(-2px);
}

.upload-zone input {
  display: none;
}

.upload-title {
  color: var(--text);
  font-size: 24px;
  font-weight: 900;
}

.preview-grid,
.result-grid,
.source-grid {
  display: grid;
  gap: 12px;
}

.preview-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 220px));
  margin-top: 16px;
}

.preview-tile,
.source-tile,
.result-tile {
  overflow: hidden;
  background: #f5f5f7;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.preview-tile {
  display: grid;
  grid-template-rows: 128px auto;
}

.preview-image-wrap {
  display: grid;
  place-items: center;
  background: #fbfbfd;
  padding: 8px;
}

.preview-image-wrap img {
  width: 100%;
  height: 112px;
  object-fit: contain;
}

.preview-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.preview-info span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-info .danger-light {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.source-tile img,
.result-tile img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin: 8px 0 22px;
}

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

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
}

.chat-messages {
  min-height: 430px;
  max-height: 560px;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  background: #f5f5f7;
  border-radius: 8px;
  padding: 18px;
}

.message {
  max-width: 78%;
  padding: 14px 16px;
  border-radius: 8px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.message.user {
  justify-self: end;
  background: var(--accent);
  color: #fff;
}

.message.assistant {
  justify-self: start;
  background: #fff;
  border: 1px solid var(--line);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 12px;
  margin-top: 14px;
}

.idea-panel {
  align-self: start;
}

.idea-panel button {
  width: 100%;
  min-height: 54px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  padding: 12px 14px;
  font-weight: 800;
}

.jobs-list {
  display: grid;
  gap: 18px;
}

.job-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.job-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.job-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 10px;
}

.job-head h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 8px;
  padding: 0 12px;
  font-weight: 900;
  background: #f5f5f7;
  color: var(--muted);
}

.status.done {
  background: #e9f8f0;
  color: #147d4f;
}

.status.running {
  background: #eaf3ff;
  color: #0059b2;
}

.status.failed {
  background: #fff0ec;
  color: #c73511;
}

.job-prompt {
  margin: 14px 0;
  color: var(--text);
  line-height: 1.7;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.job-meta span,
.task-pill {
  background: #f5f5f7;
  border-radius: 8px;
  padding: 8px 10px;
}

.task-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.task-pill.done {
  color: #147d4f;
}

.task-pill.failed {
  color: #c73511;
}

.source-grid {
  grid-template-columns: repeat(auto-fit, minmax(120px, 160px));
  margin-top: 14px;
}

.source-tile img {
  height: 120px;
}

.result-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin-top: 16px;
}

.result-tile img {
  height: 260px;
}

.result-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  flex-wrap: wrap;
}

.result-actions a {
  color: var(--blue);
  font-weight: 900;
  text-decoration: none;
}

.enhance-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.enhance-controls select {
  width: 126px;
  min-height: 38px;
  padding: 7px 9px;
}

.enhance-controls .ghost {
  min-height: 38px;
  padding: 0 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
}

.modal-panel {
  position: relative;
  width: min(1180px, 100%);
  max-height: min(86vh, 980px);
  overflow-y: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.2);
  padding: 26px;
}

.modal-head,
.detail-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.modal-head {
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.2;
}

.detail-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin: 16px 0;
}

.detail-block {
  margin-top: 18px;
}

.detail-block h3 {
  margin: 0 0 12px;
  font-size: 22px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 24px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.key-form {
  display: grid;
  gap: 12px;
}

.key-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.key-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.key-row strong {
  overflow-wrap: anywhere;
}

.key-row small {
  color: var(--muted);
}

.switch-row {
  grid-template-columns: 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.switch-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 600;
}

.switch-row input {
  width: 24px;
  height: 24px;
  accent-color: var(--accent);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: 360px;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.confetti.small {
  opacity: 0.9;
}

.shape {
  position: absolute;
  display: block;
}

.shape.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
}

.shape.curl,
.shape.loop,
.shape.dash,
.shape.flower {
  width: 64px;
  height: 64px;
}

.shape.curl {
  border-left: 9px solid var(--accent);
  border-radius: 50%;
  transform: rotate(28deg);
}

.shape.loop {
  border: 9px solid var(--yellow);
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(-26deg);
}

.shape.dash {
  width: 44px;
  height: 14px;
  border-radius: 8px;
  background: var(--accent-2);
}

.shape.flower {
  border: 8px solid var(--pink);
  border-radius: 50%;
  box-shadow: 22px 0 0 -8px var(--pink), -22px 0 0 -8px var(--pink), 0 22px 0 -8px var(--pink), 0 -22px 0 -8px var(--pink);
}

.shape.a {
  left: 7%;
  top: 4%;
}

.shape.b {
  left: 38%;
  top: 8%;
}

.shape.c {
  left: 76%;
  top: 9%;
  background: var(--pink);
}

.shape.d {
  left: 58%;
  top: 18%;
}

.shape.e {
  left: 18%;
  top: 22%;
}

.shape.f {
  left: 86%;
  top: 34%;
  background: var(--yellow);
}

@media (max-width: 980px) {
  .login-panel,
  .workbench,
  .split-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .hero-band,
  .topbar,
  .section-title,
  .job-head {
    flex-direction: column;
    align-items: stretch;
  }

  .summary-strip,
  .admin-stats {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px 14px 48px;
  }

  .login-panel {
    padding: 28px;
  }

  .tab {
    min-height: 50px;
    padding: 0 16px;
    font-size: 16px;
  }

  .login-panel h1,
  .topbar h1 {
    font-size: 34px;
    line-height: 1.12;
  }

  .brand-title span {
    margin-left: 6px;
    font-size: 0.38em;
  }

  .topbar {
    gap: 14px;
    padding-top: 18px;
  }

  .account-box {
    flex-wrap: wrap;
    gap: 8px;
  }

  #userBadge,
  .account-box .ghost {
    min-height: 44px;
    padding: 10px 13px;
  }

  .hero-band h2,
  .section-title h2,
  .chat-panel h2 {
    font-size: 25px;
  }

  .hero-band {
    min-height: 0;
    padding: 26px 22px;
  }

  .hero-band .confetti {
    display: none;
  }

  .summary-strip {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .summary-strip span {
    min-height: 96px;
  }

  .tool-panel,
  .main-panel,
  .chat-panel,
  .idea-panel,
  .admin-panel {
    padding: 18px;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 100%;
  }

  .key-row {
    grid-template-columns: 1fr;
  }
}
