:root {
  --bg: #edf4f1;
  --panel: #ffffff;
  --text: #17211d;
  --muted: #60716b;
  --line: #d5e4de;
  --green: #24785f;
  --green-dark: #145843;
  --danger: #b42318;
  --shadow: 0 22px 55px rgba(24, 45, 38, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 410px 1fr;
  gap: 16px;
  min-height: 100vh;
  padding: 16px;
}

.sidebar,
.topbar,
.output {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 20px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.brand {
  margin-bottom: 22px;
}

.brand p,
.topbar p {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.brand h1,
.topbar h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
}

.brand span {
  display: inline-block;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5fbf8;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.account-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf9;
  padding: 12px;
}

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

.section-title {
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.section-title strong {
  color: var(--green-dark);
}

.account-grid {
  display: grid;
  gap: 8px;
}

.account-actions button {
  flex: 1;
  padding: 9px 10px;
}

.hint,
.cost-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfc;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36, 120, 95, 0.13);
}

.two {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 10px;
}

.three {
  display: grid;
  grid-template-columns: 1fr 1fr 90px;
  gap: 10px;
  align-items: end;
}

.check-row {
  align-items: center;
  grid-template-columns: 20px 1fr;
  min-height: 45px;
}

.check-row input {
  width: auto;
}

.prompt-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-tools button {
  padding: 9px 11px;
  font-size: 13px;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 900;
}

button:hover {
  background: var(--green-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary {
  background: #e5efeb;
  color: var(--green-dark);
}

.workspace {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
  min-width: 0;
}

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

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

.tab {
  background: #e5efeb;
  color: var(--green-dark);
  padding: 8px 11px;
  font-size: 13px;
}

.tab.active {
  background: var(--green);
  color: #fff;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.actions button {
  background: #e5efeb;
  color: var(--green-dark);
  padding: 9px 12px;
}

.output {
  overflow: auto;
  padding: 22px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view[hidden] {
  display: none !important;
}

.output h1 {
  margin: 0 0 16px;
  font-size: 28px;
}

.output h2 {
  margin: 24px 0 10px;
  font-size: 21px;
}

.output h3 {
  margin: 20px 0 8px;
  font-size: 17px;
}

.output p,
.output li {
  color: #344640;
  line-height: 1.7;
  font-size: 15px;
}

.output pre {
  overflow: auto;
  border-radius: 6px;
  background: #101916;
  color: #d9fff1;
  padding: 14px;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 13px;
}

.empty {
  display: grid;
  place-content: center;
  min-height: calc(100vh - 140px);
  text-align: center;
  color: var(--muted);
}

.empty h2 {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: 46px;
}

.error {
  border: 1px solid rgba(180, 35, 24, 0.28);
  border-radius: 8px;
  background: #fff4f2;
  color: var(--danger);
  padding: 12px 14px;
  font-weight: 800;
}

.notice {
  border: 1px solid #f1cf86;
  border-radius: 6px;
  background: #fff9e8;
  color: #7a5200;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.hidden {
  display: none;
}

.image-tools {
  display: grid;
  gap: 14px;
}

.reference-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf9;
  padding: 12px;
}

.reference-preview:empty {
  display: none;
}

.reference-preview img {
  display: block;
  max-width: 280px;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

textarea {
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfc;
  color: var(--text);
  padding: 12px;
  outline: none;
  font: inherit;
  line-height: 1.55;
}

.image-result {
  margin-top: 16px;
}

.image-result img {
  display: block;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.image-gallery figure {
  margin: 0;
}

.image-gallery figcaption {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.image-gallery figcaption .secondary,
.image-gallery figcaption .link-button {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 12px;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.history-card,
.empty-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-card p {
  color: #344640;
  line-height: 1.55;
  font-size: 13px;
}

.history-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f5fbf8;
  margin-bottom: 10px;
}

.history-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--green-dark);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.pricing-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.pricing-card h3 {
  margin: 8px 0;
}

.pricing-card code {
  display: block;
  overflow-wrap: anywhere;
  border-radius: 6px;
  background: #eef6f2;
  color: var(--green-dark);
  padding: 8px;
  font-size: 12px;
}

.pricing-card p {
  margin: 10px 0 6px;
}

.pricing-card small {
  color: var(--muted);
  line-height: 1.45;
}

.cmf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.cmf-grid label {
  align-content: start;
}

.cmf-result {
  margin-top: 14px;
}

.price-tag {
  display: inline-block;
  border-radius: 999px;
  background: #e5efeb;
  color: var(--green-dark);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

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

@media (max-width: 620px) {
  .shell {
    padding: 10px;
  }

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

  .history-list {
    grid-template-columns: 1fr;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .three,
  .cmf-grid,
  .image-gallery {
    grid-template-columns: 1fr;
  }
}
