:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --ink: #11233f;
  --subtle: #5f708d;
  --primary: #0f4ea8;
  --primary-deep: #0a3578;
  --accent: #cb9847;
  --ok: #0a8a5b;
  --warn: #b85b00;
  --err: #c52020;
  --line: #d6dfee;
  --radius: 14px;
  --shadow: 0 10px 24px rgba(17, 35, 63, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 0%, rgba(15, 78, 168, 0.12), transparent 30%),
    radial-gradient(circle at 95% 0%, rgba(203, 152, 71, 0.15), transparent 28%),
    var(--bg);
}

.po-app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 12px;
}

.po-header {
  border-radius: var(--radius);
  background: linear-gradient(130deg, var(--primary-deep), var(--primary));
  color: #fff;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow);
}

.po-header h1 {
  margin: 0;
  font-size: 24px;
}

.po-header p {
  margin: 6px 0 0;
  opacity: 0.9;
  font-size: 13px;
}

.po-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.po-layout {
  display: grid;
  grid-template-columns: 290px 1fr 400px;
  gap: 12px;
  min-height: 0;
}

.po-panel {
  min-width: 0;
}

.po-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 6px 16px rgba(17, 35, 63, 0.07);
}

.po-card h2 {
  margin: 0;
  font-size: 16px;
}

.po-subtle {
  margin: 8px 0 0;
  color: var(--subtle);
  font-size: 12px;
}

.po-step-nav {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.po-step-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 4px;
  cursor: pointer;
  background: #fdfefe;
}

.po-step-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(203, 152, 71, 0.22);
}

.po-step-item-title {
  font-size: 13px;
  font-weight: 600;
}

.po-step-item-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--subtle);
}

.po-chip-error {
  color: var(--err);
}

.po-chip-ok {
  color: var(--ok);
}

.po-form-card {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
}

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

.po-step-form {
  display: grid;
  gap: 10px;
  align-content: start;
}

.po-field {
  display: grid;
  gap: 6px;
}

.po-field label {
  font-size: 12px;
  color: var(--subtle);
}

.po-input,
.po-textarea {
  width: 100%;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

.po-textarea {
  min-height: 94px;
  resize: vertical;
}

.po-field-error {
  color: var(--err);
  font-size: 12px;
}

.po-nav-actions,
.po-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.po-score-wrap {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.po-score {
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
}

.po-score-high {
  color: #055539;
  background: #d3f8ea;
}

.po-score-mid {
  color: #934300;
  background: #ffe9cf;
}

.po-score-low {
  color: #8f1515;
  background: #ffe0e0;
}

.po-preview {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: #f7faff;
  border-radius: 10px;
  padding: 10px;
  min-height: 360px;
  max-height: 460px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.6;
}

.po-recent-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.po-recent-item {
  border: 1px dashed #bfd0ec;
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.po-recent-item p {
  margin: 0;
  color: var(--subtle);
  font-size: 12px;
}

.po-diagnostics {
  display: grid;
  gap: 8px;
}

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

.po-summary {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.po-summary-high {
  color: #055539;
  background: #d3f8ea;
}

.po-summary-mid {
  color: #934300;
  background: #ffe9cf;
}

.po-summary-low {
  color: #8f1515;
  background: #ffe0e0;
}

.po-diagnostics-list {
  max-height: 200px;
  overflow: auto;
  display: grid;
  gap: 6px;
}

.po-diag-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
}

.po-diag-item.error {
  background: #fff1f1;
  border-color: #ffcaca;
}

.po-diag-item.warning {
  background: #fff7ef;
  border-color: #ffd6a7;
}

.po-diag-item.info {
  background: #eff6ff;
  border-color: #c6dbfa;
}

.po-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.po-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.po-btn-primary {
  background: linear-gradient(100deg, var(--accent), #e0b46f);
  color: #2e2200;
  font-weight: 600;
}

.po-btn-ghost {
  background: #fff;
  color: var(--primary-deep);
  border: 1px solid #b9cbeb;
}

.po-btn-danger {
  background: #ffe3e3;
  color: #8f1b1b;
  border: 1px solid #ffc8c8;
}

.po-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: rgba(17, 35, 63, 0.92);
  color: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.po-toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .po-right {
    grid-column: 1 / -1;
  }

  .po-preview {
    min-height: 220px;
    max-height: 320px;
  }
}

@media (max-width: 768px) {
  .po-app {
    padding: 8px;
  }

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

  .po-layout {
    grid-template-columns: 1fr;
  }

  .po-left,
  .po-center,
  .po-right {
    grid-column: auto;
  }
}
