:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --line: #d9ded5;
  --text: #1f2520;
  --muted: #667065;
  --green: #276749;
  --green-dark: #1f513a;
  --amber: #a05d00;
  --blue: #285a8f;
  --danger: #a33232;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 15px;
}

.auth-pending .topbar,
.auth-pending .statusStrip,
.auth-pending .workspace,
.auth-pending .results,
.auth-pending .modal {
  display: none;
}

.loginScreen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-ready .loginScreen {
  display: none;
}

.loginPanel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(31, 37, 32, 0.08);
}

.loginPanel p {
  color: var(--muted);
}

.userBadge {
  color: #374238;
  font-weight: 700;
  white-space: nowrap;
}

.monthlyCostBadge {
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid #cbd8cf;
  border-radius: 999px;
  background: #f5fbf7;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.topbar {
  min-height: 58px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(130px, 1fr);
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 4px 14px rgba(31, 37, 32, 0.04);
}

.brandBlock {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brandLogo {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.versionChip {
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid #a8d7bd;
  border-radius: 999px;
  background: #eef8f2;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.accountArea {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.statusStrip {
  width: min(1880px, calc(100% - 24px));
  margin: 12px auto 0;
  display: grid;
  grid-template-columns: minmax(640px, 1fr) minmax(430px, auto);
  gap: 8px;
}

.statusRail {
  min-width: 0;
  border: 1px solid #d6dfd4;
  border-radius: 8px;
  background: #ffffff;
  min-height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 26px;
  box-shadow: 0 6px 18px rgba(31, 37, 32, 0.035);
  overflow: hidden;
}

.statusRail span {
  min-width: 0;
  color: #2d352f;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.statusRail strong {
  min-width: 0;
  color: var(--green);
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.statusRailMain {
  justify-content: flex-start;
}

.statusRailMain span:nth-child(3),
.statusRailMain span:nth-child(4) {
  flex: 1 1 230px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.statusRailMain span:nth-child(3) strong,
.statusRailMain span:nth-child(4) strong {
  display: inline;
}

.statusRailStats {
  justify-content: center;
  gap: 18px;
}

.statusLabel {
  color: #1f2520 !important;
  font-weight: 800 !important;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 21px;
  line-height: 1.2;
  white-space: nowrap;
}

h2 {
  font-size: 18px;
}

.actions,
.buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.actions {
  justify-content: center;
}

.actions .tab {
  gap: 7px;
  min-height: 34px;
  padding: 0 13px;
  border-color: transparent;
  color: #1f2520;
}

.actions .tab::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: currentColor;
  font-size: 13px;
  line-height: 1;
}

#tabGenerate::before { content: "+"; }
#tabStrategyQueue::before { content: "S"; }
#tabEdit::before { content: "E"; }
#tabBatchLifestyle::before { content: "Q"; }
#tabHistory::before { content: "H"; }
#openSettings::before { content: "*"; }
#logoutBtn::before { content: ">"; }

.userAdminPanel {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.userList {
  display: grid;
  gap: 10px;
}

.passwordWrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.passwordWrap input {
  width: 100%;
}

.passwordToggle {
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.userItem {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.userItem div:first-child {
  display: grid;
  gap: 4px;
}

.userItem span {
  color: var(--muted);
  font-size: 13px;
}

button,
.download {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

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

.secondaryButton:hover {
  background: #eef6f1;
}

.dangerButton {
  background: #fff;
  border-color: var(--danger);
  color: var(--danger);
}

.dangerButton:hover {
  background: #fff1f1;
  color: var(--danger);
}

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

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

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

main {
  width: min(1880px, calc(100% - 32px));
  margin: 14px auto 40px;
  display: grid;
  gap: 18px;
}

.workspace {
  grid-template-columns: minmax(460px, 0.78fr) minmax(680px, 1.22fr);
  align-items: start;
  gap: 18px;
}

.inputColumn {
  display: none;
  gap: 18px;
  grid-column: 1;
}

.inputColumn.visible {
  display: grid;
}

.panel,
.results {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: none;
}

.panel.visible,
.results {
  display: block;
}

.results {
  grid-column: 2;
  grid-row: 1;
}

#strategyQueuePanel.visible,
#batchLifestylePanel.visible,
#historyPanel.visible {
  grid-column: 1;
  grid-row: 1;
}

#strategyQueuePanel.visible,
#batchLifestylePanel.visible,
#historyPanel.visible {
  width: min(760px, 100%);
  justify-self: end;
}

#strategyQueuePanel.visible ~ .results,
#batchLifestylePanel.visible ~ .results,
#historyPanel.visible ~ .results {
  width: min(940px, 100%);
  justify-self: start;
}

#generatePanel.visible {
  overflow: visible;
}

.panelHead {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panelTitle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.panelHead span {
  color: var(--muted);
  font-size: 13px;
}

.guideButton {
  min-height: 28px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  gap: 4px;
}

.guideButton::before {
  content: "?";
  width: 16px;
  height: 16px;
  border: 1px solid #98a59a;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #667065;
  font-size: 11px;
  line-height: 1;
}

.guideButton:hover {
  background: #eef6f1;
  color: var(--green);
}

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

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

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

.checkboxField {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 12px;
}

.checkboxField input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--green);
}

.checkboxField span {
  display: grid;
  gap: 4px;
  color: var(--text);
}

.formField {
  display: grid;
  gap: 9px;
  border: 1px solid #dce5da;
  border-radius: 8px;
  background: #fbfdfa;
  padding: 12px;
}

.inputTip {
  border: 1px solid #f1c2c2;
  background: #fff4f4;
  color: #9f1d1d;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.45;
}

.colorVariantField {
  border: 1px solid #dce5da;
  border-radius: 8px;
  background: #fbfdfa;
  padding: 12px;
}

.colorVariantAssets {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.colorVariantAssetItem {
  display: grid;
  gap: 8px;
  border: 1px solid #dce5da;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.colorVariantAssetHead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.colorVariantAssetHead strong {
  color: var(--green);
}

.colorVariantAssetZone {
  min-height: 92px;
}

.fieldLabel {
  color: var(--green);
  font-weight: 600;
  font-size: 14px;
}

small {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.45;
}

.pasteZone {
  min-height: 118px;
  border: 1px dashed #9db4a7;
  border-radius: 8px;
  background: #fbfcfa;
  padding: 12px;
  display: grid;
  gap: 8px;
  cursor: text;
}

.pasteZone:focus {
  outline: 2px solid rgba(39, 103, 73, 0.22);
  border-color: var(--green);
  background: #fff;
}

.pasteZone.active {
  border-color: var(--green);
  background: #ffffff;
}

.pasteZone strong {
  color: var(--text);
  font-size: 14px;
}

.pasteZone span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.pasteZone .pasteCount {
  color: var(--green);
  font-weight: 700;
}

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

.pasteCell {
  min-height: 138px;
}

.pasteCell .thumbGrid {
  grid-template-columns: 1fr;
}

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

.thumbItem {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  display: grid;
}

.thumbItem img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #eef1ec;
}

.thumbItem small {
  padding: 4px 6px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  word-break: break-all;
}

.thumbItem button {
  min-height: 28px;
  border-radius: 0;
  border: 0;
  background: #fff;
  color: var(--danger);
  font-size: 12px;
}

.thumbItem button:hover {
  background: #fff1f1;
}

.wide {
  grid-column: 1 / -1;
}

.promptSlotBlock {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  margin-top: 8px;
  background: #fbfdf9;
}

.promptSlotBlock h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.promptSlotBlock p {
  margin: 6px 0;
}

.advancedSetting {
  display: none;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(39, 103, 73, 0.2);
  border-color: var(--green);
}

.notice,
.message {
  border: 1px solid #e0d2b8;
  background: #fff8ec;
  color: #5f3d07;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.message.error {
  border-color: #e1b7b7;
  background: #fff1f1;
  color: var(--danger);
}

.progressBox {
  border: 1px solid var(--line);
  background: #fbfcfa;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

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

.progressMeta strong {
  color: var(--green);
}

.progressMeta span {
  color: var(--muted);
  font-size: 13px;
}

.progressTrack {
  height: 10px;
  border-radius: 999px;
  background: #e8ede6;
  overflow: hidden;
}

.progressFill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--green);
  transition: width 180ms ease;
}

.strategy {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

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

.strategyBlock {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}

.strategyBlock h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.strategyBlock p,
.strategyBlock li {
  color: var(--muted);
  line-height: 1.55;
}

.strategyField {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  margin: 8px 0;
}

.strategyField input {
  width: 100%;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}

.strategyField small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.4;
}

.costEstimate {
  background: #fffaf0;
  border-color: #ead4ad;
}

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

.costGrid div {
  border: 1px solid #ead4ad;
  background: #fffdf8;
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}

.costGrid span,
.regenCost {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.costGrid strong {
  display: block;
  color: var(--green);
  font-size: 18px;
  margin-top: 4px;
}

.regenCost {
  margin-top: 8px;
  color: var(--green);
  font-weight: 700;
}

.historyTools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.historyTools input {
  flex: 1 1 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

.historyFilterBar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 12px;
}

.filterChip {
  min-height: 32px;
  padding: 0 10px;
  border-color: #d6dfd4;
  background: #fff;
  color: #455348;
  font-size: 13px;
}

.filterChip.active,
.filterChip:hover {
  border-color: #b9d9c3;
  background: #eef8f0;
  color: var(--green);
}

.historyList {
  display: grid;
  gap: 8px;
}

.historyItem {
  position: relative;
  display: grid;
  gap: 7px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 72px 14px 14px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(31, 37, 32, 0.035);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.historyItem:hover,
.historyItem.active {
  border-color: var(--green);
  background: #f8fcf8;
  box-shadow: 0 10px 28px rgba(31, 37, 32, 0.08);
}

.historyItem.active {
  transform: translateY(-1px);
}

.historyItem strong,
.batchItemHead h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.historyItem > strong {
  color: #1f2a22;
  font-size: 15px;
  line-height: 1.35;
}

.historyItem > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.historyItem > em {
  color: #276749;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.45;
}

.historyItem > small {
  color: #6c766a;
  font-size: 12px;
  line-height: 1.45;
}

.historyItemActions {
  position: absolute;
  top: 12px;
  right: 12px;
}

.historyDeleteButton {
  min-height: 30px;
  padding: 0 10px;
}

.statePill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid #cfe4d4;
  border-radius: 6px;
  background: #eef8f0;
  color: var(--green);
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.historyPill {
  background: #f8faf5;
  border-color: #d7ded2;
  color: #4d5a4e;
}

.previewPill.complete {
  background: #eef8f0;
  border-color: #b9d9c3;
  color: var(--green);
}

.previewPill.partial {
  background: #fff8ec;
  border-color: #e0d2b8;
  color: #6b4b0b;
}

.historyItem:hover,
.historyItem.active {
  border-color: var(--green);
  background: #f4faf5;
}

.historyItem span,
.historyItem small,
.historyItem em,
.emptyState {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.historyItem em {
  color: var(--green);
  font-style: normal;
}

.emptyState {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfa;
}

.errorText {
  color: var(--danger);
}

.historyDetailHead {
  background: #f6faf7;
}

.sourceStrip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}

.sourceStrip img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sourceReplaceCard {
  display: grid;
  gap: 6px;
}

.sourceReplaceTools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.sourceReplaceTools select {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
}

.sourceReplaceTools button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.fileList {
  display: grid;
  gap: 6px;
}

.fileList span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.batchSummary {
  border: 1px solid #e0d2b8;
  background: #fff8ec;
  color: #5f3d07;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 12px;
}

.batchRunPanel {
  border: 1px solid #d8e2da;
  border-radius: 8px;
  background: #fbfdfa;
  padding: 12px;
  margin-bottom: 12px;
}

.batchRunHeader,
.batchRunRow,
.batchRunNow {
  display: flex;
  gap: 10px;
}

.batchRunHeader {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.batchRunHeader strong,
.batchRunRow strong,
.batchRunNow strong {
  color: #1f2a22;
}

.batchRunHeader span,
.batchRunRow p,
.batchRunNow p,
.batchRunNow span {
  color: var(--muted);
  font-size: 12px;
}

.batchRunHeader span {
  display: block;
  margin-top: 3px;
}

.batchRunNow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 10px;
}

.batchRunNow > div,
.batchRunRow {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.batchRunNow p,
.batchRunRow p {
  margin: 4px 0 0;
  line-height: 1.45;
}

.batchRunList {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.batchRunRow {
  justify-content: space-between;
  align-items: flex-start;
}

.batchRunRow.running {
  border-color: #b7d8be;
  background: #f5fbf6;
}

.batchRunRow.error {
  border-color: #e6b7b7;
  background: #fff7f7;
}

.emptyState.small {
  padding: 10px;
  font-size: 13px;
}

.batchList {
  display: grid;
  gap: 14px;
}

.batchGroup {
  display: grid;
  gap: 8px;
  padding-left: 10px;
  border-left: 3px solid #d6dfd4;
}

.batchGroupTitle {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-left: 0;
  background: transparent;
  padding: 2px 0;
  color: var(--green);
  font-size: 13px;
}

.groupToggle {
  width: 100%;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.groupToggle span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.groupToggle:hover span,
.groupToggle:hover strong {
  color: var(--green);
}

.batchGroup-running {
  border-left-color: var(--green);
}

.batchGroup-running .batchGroupTitle {
  color: var(--green);
}

.batchGroup-failed {
  border-left-color: var(--danger);
}

.batchGroup-failed .batchGroupTitle {
  color: var(--danger);
}

.batchGroup-partial {
  border-left-color: var(--amber);
}

.batchGroup-partial .batchGroupTitle {
  color: var(--amber);
}

.batchGroup-waiting {
  border-left-color: var(--blue);
}

.batchGroup-waiting .batchGroupTitle {
  color: var(--blue);
}

.batchGlobalActions,
.batchQuickActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.batchQuickActions {
  margin: 10px 0;
}

.batchItem {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(31, 37, 32, 0.035);
}

.batchItem.batchState-running,
.batchItem.batchState-waiting {
  border-left: 4px solid var(--blue);
}

.batchItem.batchState-partial {
  border-left: 4px solid var(--amber);
}

.batchItem.batchState-failed {
  border-left: 4px solid var(--danger);
}

.batchItem.batchState-done {
  border-left: 4px solid var(--green);
}

.batchItem.batchState-idle {
  border-left: 4px solid #aeb8ad;
}

.batchItemHead {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.batchItemHead h3 {
  margin: 0 0 4px;
  font-size: 15px;
  line-height: 1.35;
}

.batchItemHead p {
  margin: 3px 0;
  color: var(--muted);
  font-size: 13px;
}

.strategyQueueActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.strategyQueueDetailHead {
  border-left: 4px solid var(--green);
}

.batchSources {
  margin: 10px 0;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
}

.batchImageGrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(36px, 1fr));
  gap: 6px;
  margin: 10px 0 8px;
}

.batchImageOption {
  display: grid;
  grid-template-columns: auto;
  justify-items: center;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 4px;
  background: #fbfcfa;
  cursor: pointer;
  min-height: 50px;
  text-align: center;
}

.batchImageOption.generated {
  border-color: #cfe4d4;
  background: #f4fbf5;
}

.batchImageOption.failed {
  border-color: #e7b7b7;
  background: #fff7f7;
}

.batchImageOption input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.batchImageOption span {
  font-size: 12px;
  font-weight: 700;
  color: #1f2a22;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batchImageOption em {
  color: var(--green);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batchImageOption.failed em {
  color: #b23b3b;
}

.batchItem details {
  margin-top: 8px;
}

.batchItem summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 700;
  font-size: 13px;
}

.batchItem textarea {
  min-height: 110px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: #2c332d;
}

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

.imageSwapTools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: #fbfdfa;
}

.imageSwapTools label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.imageSwapTools select {
  min-width: 0;
  min-height: 32px;
  padding: 6px 8px;
  font-size: 13px;
}

.imageSwapTools button {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.imageMarkTools input {
  min-width: 0;
  min-height: 32px;
  padding: 6px 8px;
  font-size: 13px;
}

.imageMarkTools button {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.batchPromptHint {
  margin: 8px 0 10px;
  color: #7a4b03;
  font-size: 13px;
  line-height: 1.45;
}

.batchPromptList {
  display: grid;
  gap: 10px;
}

.batchPromptEdit {
  border: 1px solid #d8e2da;
  border-radius: 8px;
  background: #fbfdfa;
  padding: 10px;
}

.batchPromptEditHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.batchPromptEditHead strong {
  font-size: 13px;
}

.batchPromptEditHead span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.batchPromptEdit button {
  margin-top: 8px;
}

.editableList {
  display: grid;
  gap: 8px;
}

.editableItem {
  display: grid;
  gap: 4px;
}

.editableItemHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.editableItem span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.reorderActions {
  display: inline-flex;
  gap: 4px;
}

.reorderActions button {
  min-height: 24px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1;
  background: #fff;
  color: var(--green);
}

.editableItem textarea {
  min-height: 58px;
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  resize: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.coreMark {
  color: #b42323;
  background: #ffe6e6;
  border: 1px solid #f1a6a6;
  border-radius: 4px;
  padding: 0 3px;
  font-weight: 700;
}

.corePreviewLine {
  min-height: 20px;
  line-height: 1.4;
}

.confirmBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  background: #fbfcfa;
  border-radius: 8px;
  padding: 12px;
}

.confirmBar span {
  color: var(--muted);
  font-size: 13px;
}

.confirmActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.imageSelectBlock {
  border-color: #d7e6d8;
  background: #fbfdfb;
}

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

.imageSelectHead h3 {
  margin: 0;
}

.imageSelectHead span {
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.imageSelectGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.imageSelectItem {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  cursor: pointer;
}

.imageSelectItem input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  flex: 0 0 auto;
}

.imageSelectItem span {
  font-size: 13px;
  font-weight: 700;
  color: #1f2a22;
}

.editWarning {
  border: 1px solid #f1c2c2;
  background: #fff4f4;
  color: #9f1d1d;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.45;
}

.sensitiveBlock {
  border: 2px solid #f59e0b;
  border-left-width: 7px;
  background: #fff7ed;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15);
}

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

.sensitiveHead h3 {
  margin: 0;
}

.sensitiveHead span {
  color: #7a4b03;
  font-size: 13px;
  font-weight: 700;
}

.sensitiveNote {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.sensitiveOk,
.sensitiveWarn {
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 700;
}

.sensitiveOk {
  border: 1px solid #cfe4d4;
  background: #f4fbf5;
  color: var(--green);
}

.sensitiveWarn {
  border: 1px solid #f1c2c2;
  background: #fff4f4;
  color: #9f1d1d;
}

.sensitiveHitList {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding-left: 18px;
  color: #5e2c2c;
  font-size: 13px;
  line-height: 1.5;
}

.sensitiveHitList mark {
  background: #ffe1e1;
  border: 1px solid #f3a4a4;
  border-radius: 4px;
  color: #9f1d1d;
  padding: 0 4px;
  font-weight: 700;
}

.sensitiveEditor {
  margin-top: 10px;
}

.sensitiveEditor summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 700;
}

.sensitiveEditor label {
  margin-top: 10px;
}

.promptList {
  display: grid;
  gap: 10px;
}

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

.promptSelect {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-height: 28px;
  cursor: pointer;
}

.promptSelect input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  flex: 0 0 auto;
}

.promptSelect strong {
  flex: 1;
}

.promptSelect span {
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.promptItem textarea {
  min-height: 116px;
  margin-top: 8px;
  color: #2c332d;
}

.promptPreview {
  max-height: 210px;
  overflow: auto;
  margin-top: 8px;
  border: 1px solid #ead4ad;
  border-radius: 8px;
  padding: 10px;
  background: #fffdf8;
  color: #2c332d;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.promptRaw {
  min-height: 118px !important;
  font-size: 13px;
  line-height: 1.55;
  background: #fff;
  border-color: #d6ded4;
}

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

.imageCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.imageCard img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #f0f2ee;
  display: block;
}

.missingCard {
  border-style: dashed;
}

.missingImage {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  background: #fff7f7;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.imageMeta {
  padding: 10px;
  display: grid;
  gap: 3px;
}

.imageMeta strong {
  font-size: 14px;
}

.imageMeta span {
  color: var(--muted);
  font-size: 13px;
}

.cloudInlineLink {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.cardPrompt {
  border-top: 1px solid var(--line);
  padding: 10px;
}

.cardPrompt summary {
  color: var(--green);
  cursor: pointer;
  font-weight: 700;
}

.cardPrompt textarea {
  min-height: 120px;
  margin-top: 10px;
  font-size: 13px;
}

.regenActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.regenStatus {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(20, 25, 22, 0.35);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal.hidden {
  display: none;
}

.modalPanel {
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 18px 60px rgba(10, 20, 14, 0.18);
}

.guidePanel {
  width: min(760px, 100%);
}

.guideContent {
  display: grid;
  gap: 12px;
}

.guideContent section {
  border: 1px solid #e2e7df;
  border-radius: 8px;
  background: #fbfcfa;
  padding: 12px;
  display: grid;
  gap: 7px;
}

.guideContent h3 {
  margin: 0;
  color: var(--green);
  font-size: 15px;
}

.guideContent p {
  color: #374238;
  font-size: 14px;
  line-height: 1.55;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 16px;
  }

  .brandBlock,
  .accountArea {
    justify-content: center;
  }

  .actions {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .actions .tab {
    flex: 0 0 auto;
  }

  main {
    width: calc(100% - 20px);
    margin-top: 12px;
  }

  .statusStrip {
    width: calc(100% - 20px);
    grid-template-columns: 1fr;
    margin-top: 10px;
  }

  .statusRail {
    min-height: auto;
    padding: 10px 12px;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 18px;
  }

  .statusRailMain span:nth-child(3),
  .statusRailMain span:nth-child(4) {
    flex: 1 1 100%;
  }

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

  .inputColumn {
    position: static;
  }

  #strategyQueuePanel,
  #batchLifestylePanel,
  #historyPanel,
  .results {
    grid-column: auto;
    grid-row: auto;
    max-height: none;
    overflow: visible;
  }

  #generatePanel.visible {
    max-height: none;
    overflow-y: visible;
  }

  .form,
  .formSubgrid,
  .gallery,
  .strategyGrid,
    .costGrid,
    .thumbGrid,
    .pasteGrid,
    .batchImageGrid {
    grid-template-columns: 1fr;
  }

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