:root {
  color-scheme: light;
  --bg: #eef3fb;
  --surface: #ffffff;
  --surface-soft: #f7f9fd;
  --ink: #0f1a2e;
  --muted: #6f7d91;
  --line: #dde5f1;
  --brand: #2f7cf6;
  --brand-strong: #225dde;
  --navy: #0d172a;
  --success: #0f9960;
  --warning: #b7791f;
  --danger: #d64545;
  --shadow: 0 24px 70px rgba(29, 49, 86, 0.13);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(180deg, #f4f7fc 0%, #eaf0fb 52%, #f5f8ff 100%);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.topbar {
  position: relative;
  display: flex;
  justify-content: center;
  min-height: 58px;
}

.product-switch {
  display: grid;
  grid-template-columns: repeat(2, 110px);
  gap: 4px;
  align-items: center;
  height: 56px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(223, 230, 242, 0.9);
  border-radius: 32px;
  box-shadow: 0 10px 24px rgba(26, 37, 65, 0.08);
}

.product-tab {
  height: 44px;
  border: 0;
  border-radius: 24px;
  color: #435065;
  font-weight: 800;
  font-size: 18px;
  background: transparent;
  cursor: pointer;
}

.product-tab.is-active {
  color: #ffffff;
  background: var(--navy);
}

.language-select {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 150px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: #4b5768;
  background: rgba(255, 255, 255, 0.8);
  font-weight: 700;
}

.language-select select {
  width: 92px;
  border: 0;
  color: inherit;
  background: transparent;
  outline: none;
  cursor: pointer;
}

.hero {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 42px 0 44px;
  text-align: center;
}

.service-label {
  margin: 0;
  color: var(--brand-strong);
  font-weight: 800;
}

.hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1.12;
  letter-spacing: 0;
}

.hero p {
  max-width: 720px;
}

#page-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 650;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

.pill-button,
.stock-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 24px;
  font-weight: 800;
  white-space: nowrap;
}

.pill-button {
  padding: 0 24px;
  border: 0;
  color: #ffffff;
  background: var(--navy);
  cursor: pointer;
}

.stock-pill {
  gap: 12px;
  padding: 0 18px;
  color: #20304a;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 30px rgba(42, 67, 112, 0.09);
}

.stock-pill strong {
  color: var(--brand-strong);
  font-size: 22px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 468px) minmax(0, 860px);
  gap: 30px;
  align-items: start;
  justify-content: center;
}

.guide-card,
.form-card,
.batch-dialog {
  border: 1px solid rgba(225, 232, 243, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.guide-card {
  padding: 34px 30px 30px;
}

.guide-card h2,
.form-card h2,
.batch-dialog h2 {
  margin: 0;
  letter-spacing: 0;
}

.guide-card > p {
  margin: 10px 0 20px;
  color: var(--muted);
  line-height: 1.7;
}

.guide-list {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.guide-list li {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 16px;
  padding: 20px 0;
  border-top: 1px solid #edf1f7;
}

.guide-list li:first-child {
  border-top: 0;
}

.step-num {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  color: #ffffff;
  background: var(--navy);
  font-weight: 900;
}

.guide-list h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

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

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 10px;
  padding: 0 16px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--brand-strong);
  font-weight: 800;
  text-decoration: none;
}

.form-card {
  min-height: 386px;
  padding: 64px;
}

.step-header,
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.step-header h2,
.section-title h2 {
  font-size: 32px;
}

.step-header p:not(.eyebrow),
.section-title p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.api-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--success);
  background: #e8f8f1;
  font-weight: 800;
}

.field-block {
  display: grid;
  gap: 16px;
  margin-top: 26px;
}

.field-block label {
  color: #526174;
  font-weight: 700;
}

.field-block label span {
  color: var(--danger);
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
  transition: border 0.16s ease, box-shadow 0.16s ease;
}

input {
  height: 48px;
  padding: 0 14px;
}

textarea {
  resize: vertical;
  min-height: 150px;
  padding: 14px;
  line-height: 1.6;
}

input:focus,
textarea:focus {
  border-color: rgba(47, 124, 246, 0.75);
  box-shadow: 0 0 0 4px rgba(47, 124, 246, 0.12);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 6px;
  font-weight: 850;
  cursor: pointer;
}

.primary-button {
  border: 0;
  color: #ffffff;
  background: var(--brand);
  box-shadow: 0 10px 18px rgba(47, 124, 246, 0.22);
}

.primary-button:hover {
  background: var(--brand-strong);
}

.secondary-button {
  border: 1px solid var(--line);
  color: #23324a;
  background: #ffffff;
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
}

.button-mark {
  width: 13px;
  height: 13px;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.button-mark::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -5px;
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.state-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-soft);
}

.state-row {
  display: grid;
  gap: 6px;
  min-height: 82px;
  padding: 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.state-row:nth-child(2n) {
  border-right: 0;
}

.state-row:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.state-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.state-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.activate-panel {
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.session-fields,
.uid-fields {
  display: grid;
  gap: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  cursor: pointer;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.result-panel {
  margin-top: 28px;
  padding: 18px;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #f4f8ff;
}

.result-panel.success {
  border-left-color: var(--success);
  background: #effaf5;
}

.result-panel.warning {
  border-left-color: var(--warning);
  background: #fff8ec;
}

.result-panel.danger {
  border-left-color: var(--danger);
  background: #fff3f3;
}

.result-panel span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.result-panel strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.result-panel p {
  margin: 8px 0 0;
  color: #516074;
  line-height: 1.6;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(9, 17, 32, 0.46);
  z-index: 20;
}

.batch-dialog {
  width: min(780px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  padding: 28px;
  overflow: auto;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #4b596d;
  background: #ffffff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.batch-dialog textarea {
  margin-top: 18px;
}

.batch-table-wrap {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

.batch-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.batch-table th,
.batch-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.batch-table th {
  color: #47566a;
  background: #f4f7fc;
  font-size: 13px;
  font-weight: 850;
}

.batch-table td {
  overflow-wrap: anywhere;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100% - 40px));
  z-index: 30;
}

.toast {
  padding: 14px 16px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--navy);
  box-shadow: 0 16px 36px rgba(10, 18, 32, 0.22);
  line-height: 1.5;
}

.toast.success {
  background: var(--success);
}

.toast.danger {
  background: var(--danger);
}

.toast.warning {
  background: var(--warning);
}

.is-hidden {
  display: none !important;
}

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

  .form-card {
    padding: 36px;
  }

  .topbar {
    justify-content: flex-start;
    padding-top: 44px;
  }

  .language-select {
    left: 0;
    right: auto;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 24px, 1380px);
    padding-top: 12px;
  }

  .topbar {
    justify-content: center;
    padding-top: 50px;
  }

  .product-switch {
    grid-template-columns: repeat(2, minmax(86px, 1fr));
    width: 100%;
    max-width: 320px;
  }

  .product-tab {
    font-size: 16px;
  }

  .language-select {
    left: 50%;
    transform: translateX(-50%);
  }

  .hero {
    padding: 30px 0 30px;
  }

  #page-subtitle {
    font-size: 16px;
  }

  .guide-card,
  .form-card,
  .batch-dialog {
    padding: 24px 18px;
  }

  .guide-list li {
    grid-template-columns: 40px 1fr;
    gap: 12px;
  }

  .step-num {
    width: 40px;
    height: 40px;
  }

  .step-header {
    display: grid;
  }

  .step-header h2,
  .section-title h2 {
    font-size: 26px;
  }

  .inline-field {
    grid-template-columns: 1fr;
  }

  .state-panel {
    grid-template-columns: 1fr;
  }

  .state-row,
  .state-row:nth-child(2n),
  .state-row:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .state-row:last-child {
    border-bottom: 0;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
