:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #18212f;
  --muted: #667085;
  --line: #d9e0e8;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --soft: #edf7f5;
  --shadow: 0 18px 50px rgba(24, 33, 47, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

.shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.workspace {
  min-height: calc(100vh - 48px);
}

.topbar,
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 40px);
}

h2 {
  font-size: 22px;
}

.status-pill {
  min-width: 84px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.status-pill.ready {
  border-color: rgba(15, 118, 110, 0.28);
  background: var(--soft);
  color: var(--accent-dark);
}

.mode-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  gap: 4px;
  min-height: 44px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9eef3;
}

.tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 5px 18px rgba(24, 33, 47, 0.08);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.controls {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

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

textarea {
  min-height: 168px;
  resize: vertical;
  line-height: 1.55;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.grid-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 96px;
  gap: 12px;
}

.upload-box {
  display: grid;
  gap: 8px;
  min-height: 132px;
  border: 1px dashed #9fb2c4;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  place-items: center;
  padding: 18px;
  text-align: center;
  cursor: pointer;
}

.upload-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-box strong {
  color: var(--text);
}

.upload-box small {
  font-size: 12px;
}

.preview {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: center;
}

.preview img {
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.payment-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}

.payment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.payment-head strong {
  color: var(--accent-dark);
}

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

.pay-options label {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  justify-content: center;
  padding: 0 10px;
}

.pay-options input {
  width: 16px;
  min-height: 16px;
}

.order-status {
  min-height: 40px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1.45;
  padding: 10px;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 0 14px;
}

.results {
  min-height: 620px;
  padding: 18px;
}

.message {
  min-height: 44px;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
  padding: 12px;
  line-height: 1.45;
}

.message.error {
  border-color: rgba(180, 35, 24, 0.25);
  background: #fff4f2;
  color: var(--danger);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

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

.image-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #eef2f6;
}

.image-actions {
  display: flex;
  gap: 8px;
  padding: 10px;
}

.image-actions a {
  display: inline-grid;
  min-height: 36px;
  flex: 1;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.hidden {
  display: none;
}

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

  .results {
    min-height: 420px;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100vw - 20px, 1240px);
    padding: 10px 0;
  }

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

  .mode-tabs {
    width: 100%;
  }

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