:root {
  --wj-docs-theme: #e11d2e;
  --wj-docs-theme-soft: #fff1f1;
}

.wj-docs-page {
  min-height: 100vh;
  background: #f4f6f9;
  color: #111827;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
}

.wj-docs-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 10px 18px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.wj-docs-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.wj-docs-brand img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 12px;
}

.wj-docs-brand strong {
  display: block;
  color: #e11d2e;
  font-size: 20px;
  line-height: 1.2;
}

.wj-docs-brand span {
  display: block;
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.wj-docs-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.wj-docs-theme-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 9px 0 11px;
  border: 1px solid #e0e5ed;
  border-radius: 8px;
  background: #ffffff;
  color: #475467;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.wj-docs-theme-swatch {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 50%;
  background: var(--wj-docs-theme);
}

.wj-docs-theme-control select {
  border: 0;
  outline: 0;
  background: transparent;
  color: #1f2937;
  font: inherit;
  cursor: pointer;
}

.wj-docs-actions button,
.wj-docs-row-title button,
.wj-docs-preview-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #e0e5ed;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2937;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.wj-docs-actions button.primary,
.wj-docs-preview-actions button {
  border-color: #e51b2a;
  background: #e51b2a;
  color: #ffffff;
}

.wj-docs-shell {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 12px;
  max-width: none;
  margin: 0 auto;
  padding: 12px;
}

.wj-docs-sidebar {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding: 8px;
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: #ffffff;
}

.wj-docs-sidebar h2 {
  margin: 12px 8px 7px;
  color: #e11d2e;
  font-size: 14px;
}

.wj-docs-sidebar h2:first-child {
  margin-top: 6px;
}

.wj-docs-sidebar button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 38px;
  margin-bottom: 5px;
  padding: 0 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2937;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.wj-docs-sidebar button span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.wj-docs-sidebar button.active {
  border-color: #e51b2a;
  background: #fff1f1;
  color: #e11d2e;
}

.wj-docs-workspace {
  display: grid;
  grid-template-columns: minmax(380px, 0.88fr) minmax(0, 1.12fr);
  gap: 12px;
  align-items: start;
}

.wj-docs-workspace.preview-only {
  grid-template-columns: 1fr;
}

.wj-docs-workspace.preview-only .wj-docs-form {
  display: none;
}

.wj-docs-form,
.wj-docs-preview-pane {
  min-width: 0;
}

.wj-docs-section-head,
.wj-docs-card,
.wj-docs-preview-pane {
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: #ffffff;
}

.wj-docs-section-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 14px;
}

.wj-docs-section-head span {
  color: #e11d2e;
  font-size: 13px;
  font-weight: 900;
}

.wj-docs-section-head h1 {
  margin: 6px 0 4px;
  font-size: 24px;
  line-height: 1.2;
}

.wj-docs-section-head p {
  margin: 0;
  color: #667085;
  font-weight: 700;
}

.wj-docs-card {
  margin-bottom: 8px;
  padding: 14px;
}

.wj-docs-card h3,
.wj-docs-row-title h3 {
  margin: 0 0 10px;
  color: #111827;
  font-size: 16px;
}

.wj-docs-card.utility {
  min-height: 360px;
}

.wj-docs-grid {
  display: grid;
  gap: 9px;
}

.wj-docs-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wj-docs-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wj-docs-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.wj-docs-field span {
  color: #1f2937;
  font-size: 13px;
  font-weight: 900;
}

.wj-docs-field input,
.wj-docs-field select,
.wj-docs-field textarea {
  width: 100%;
  min-height: 36px;
  box-sizing: border-box;
  border: 1px solid #d6deea;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  outline: none;
}

.wj-docs-field input,
.wj-docs-field select {
  padding: 0 12px;
}

.wj-docs-field textarea {
  min-height: 78px;
  resize: vertical;
  padding: 10px 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.wj-docs-field input:focus,
.wj-docs-field select:focus,
.wj-docs-field textarea:focus {
  border-color: #e51b2a;
  box-shadow: 0 0 0 3px rgba(229, 27, 42, 0.12);
}

.wj-docs-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wj-docs-table-scroll {
  overflow: auto;
  border: 1px solid #dfe5ee;
  border-radius: 10px;
}

.wj-docs-items {
  min-width: 980px;
  width: 100%;
  border-collapse: collapse;
}

.wj-docs-items th {
  padding: 10px;
  background: #f8fafc;
  color: #667085;
  font-size: 12px;
  text-align: left;
}

.wj-docs-items td {
  padding: 8px;
  border-top: 1px solid #edf1f6;
}

.wj-docs-items input {
  width: 100%;
  min-height: 34px;
  box-sizing: border-box;
  border: 1px solid #d6deea;
  border-radius: 7px;
  padding: 0 8px;
  font: inherit;
  font-size: 13px;
}

.wj-docs-items button.icon {
  width: 34px;
  height: 34px;
  border: 1px solid #ffe0e3;
  border-radius: 7px;
  background: #fff4f4;
  color: #e11d2e;
  cursor: pointer;
}

.wj-docs-total-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.wj-docs-total-strip span {
  padding: 7px 10px;
  border-radius: 7px;
  background: #fff1f1;
  color: #a60f1a;
  font-size: 13px;
  font-weight: 900;
}

.wj-docs-preview-pane {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding: 10px;
}

.wj-docs-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.wj-docs-preview-actions strong {
  font-size: 18px;
}

.wj-docs-sheet {
  width: min(100%, 920px);
  box-sizing: border-box;
  min-height: 0;
  padding: 20px;
  background: #ffffff;
  border: 1px solid #d9e2ef;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  color: #111827;
}

.wj-docs-sheet header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 3px solid var(--wj-docs-theme);
  padding-bottom: 16px;
}

.wj-docs-sheet h2 {
  margin: 0;
  color: #111827;
  font-size: 23px;
  letter-spacing: 0;
}

.wj-docs-sheet header p {
  margin: 6px 0 0;
  color: var(--wj-docs-theme);
  font-weight: 900;
}

.wj-docs-sheet dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 0;
  min-width: 220px;
}

.wj-docs-sheet dt {
  color: #667085;
  font-weight: 800;
}

.wj-docs-sheet dd {
  margin: 0;
  font-weight: 900;
  text-align: right;
}

.wj-docs-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.wj-docs-preview-grid div {
  min-height: 84px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: var(--wj-docs-theme-soft);
}

.wj-docs-preview-grid strong {
  color: var(--wj-docs-theme);
}

.wj-docs-preview-grid p {
  margin: 6px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #334155;
  line-height: 1.5;
}

.wj-docs-sheet table {
  width: 100%;
  table-layout: fixed;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 10px;
}

.wj-docs-sheet th,
.wj-docs-sheet td {
  padding: 5px;
  border: 1px solid #d9e2ef;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.wj-docs-sheet th {
  background: var(--wj-docs-theme-soft);
  color: #475467;
  font-weight: 900;
}

.wj-docs-sheet tfoot th {
  color: var(--wj-docs-theme);
}

.wj-docs-sheet footer {
  margin-top: 18px;
  color: #475467;
  line-height: 1.6;
}

.wj-docs-signature {
  width: 220px;
  margin: 50px 0 0 auto;
  padding-top: 10px;
  border-top: 1px solid #111827;
  text-align: center;
  color: #111827;
  font-weight: 900;
}

.wj-docs-result,
.wj-docs-result-grid {
  margin-top: 18px;
  padding: 20px;
  border-radius: 10px;
  background: #fff1f1;
  color: #e11d2e;
  font-size: 26px;
  font-weight: 950;
}

.wj-docs-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  font-size: 18px;
}

.wj-docs-muted {
  margin: -6px 0 16px;
  color: #667085;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.wj-docs-cost-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.wj-docs-cost-metric {
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.wj-docs-cost-metric span {
  display: block;
  margin-bottom: 6px;
  color: #667085;
  font-size: 13px;
  font-weight: 900;
}

.wj-docs-cost-metric strong {
  color: #111827;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.wj-docs-cost-metric.highlight {
  border-color: #fecaca;
  background: #fff1f1;
}

.wj-docs-cost-metric.highlight strong {
  color: #e11d2e;
}

.wj-shipping-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  margin-top: 18px;
  padding: 34px;
  border: 3px solid #111827;
  font-size: 22px;
  font-weight: 950;
  text-align: center;
}

.wj-docs-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.25);
}

.wj-docs-usage-status {
  display: none;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff1f1;
  color: #a60f1a;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.wj-docs-auth-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
}

.wj-docs-auth-backdrop[hidden] {
  display: none;
}

.wj-docs-auth-modal {
  position: relative;
  width: min(470px, 100%);
  padding: 30px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.3);
}

.wj-docs-auth-modal > span {
  color: #e11d2e;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.wj-docs-auth-modal h2 {
  margin: 8px 40px 14px 0;
  font-size: 25px;
}

.wj-docs-auth-modal p {
  margin: 0 0 22px;
  color: #667085;
  line-height: 1.7;
}

.wj-docs-auth-modal > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.wj-docs-auth-modal > div button {
  min-height: 44px;
  border: 1px solid #d6deea;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2937;
  font-weight: 900;
  cursor: pointer;
}

.wj-docs-auth-modal > div button.primary {
  border-color: #e51b2a;
  background: #e51b2a;
  color: #ffffff;
}

.wj-docs-auth-modal small {
  display: block;
  margin-top: 14px;
  color: #667085;
  text-align: center;
}

.wj-docs-auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #ffffff;
  color: #667085;
  font-size: 20px;
  cursor: pointer;
}

@media (max-width: 1180px) {
  .wj-docs-shell,
  .wj-docs-workspace {
    grid-template-columns: 1fr;
  }

  .wj-docs-sidebar,
  .wj-docs-preview-pane {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .wj-docs-topbar,
  .wj-docs-brand,
  .wj-docs-actions {
    align-items: stretch;
  }

  .wj-docs-topbar {
    flex-direction: column;
  }

  .wj-docs-actions button {
    flex: 1 1 120px;
  }

  .wj-docs-theme-control,
  .wj-docs-usage-status {
    flex: 1 1 auto;
    justify-content: center;
  }

  .wj-docs-grid.two,
  .wj-docs-grid.three,
  .wj-docs-result-grid,
  .wj-docs-cost-summary {
    grid-template-columns: 1fr;
  }
}

@page {
  size: A4;
  margin: 10mm;
}

@media print {
  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  .wj-docs-topbar,
  .wj-docs-sidebar,
  .wj-docs-form,
  .wj-docs-preview-actions,
  .wj-docs-toast {
    display: none !important;
  }

  .wj-docs-page,
  .wj-docs-shell,
  .wj-docs-workspace,
  .wj-docs-preview-pane {
    display: block !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  .wj-docs-sheet {
    width: 100% !important;
    max-width: none !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
  }
}
