﻿:root {
  --bg-main: #f3f0e8;
  --bg-soft: #dce9e3;
  --panel: rgba(251, 248, 240, 0.88);
  --line: rgba(30, 54, 49, 0.15);
  --text-main: #172825;
  --text-muted: #5a706a;
  --primary: #0f7668;
  --primary-deep: #0b4f46;
  --accent: #b45309;
  --accent-deep: #78350f;
  --danger: #b42318;
  --shadow: 0 18px 42px rgba(13, 43, 38, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 15% 0%, #fff7ec 0%, var(--bg-main) 45%, var(--bg-soft) 100%);
  padding: 18px;
  position: relative;
  overflow-x: hidden;
}

h1,
h2,
h3,
.eyebrow,
.btn,
.nav-btn {
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  z-index: -1;
}

.orb-a {
  width: 320px;
  height: 320px;
  top: -120px;
  right: -60px;
  background: radial-gradient(circle, rgba(255, 197, 116, 0.68), rgba(255, 197, 116, 0));
}

.orb-b {
  width: 260px;
  height: 260px;
  bottom: -90px;
  left: -60px;
  background: radial-gradient(circle, rgba(31, 143, 126, 0.6), rgba(31, 143, 126, 0));
}

.orb-c {
  width: 200px;
  height: 200px;
  top: 42%;
  left: 44%;
  background: radial-gradient(circle, rgba(255, 236, 201, 0.44), rgba(255, 236, 201, 0));
}

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

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

.sidebar {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
}

.eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin: 0 0 6px;
  color: var(--primary-deep);
}

h1 {
  margin: 0;
  font-size: 1.55rem;
}

h2 {
  margin: 0;
  font-size: 1.36rem;
}

h3 {
  margin: 0;
  font-size: 1.06rem;
}

.muted {
  color: var(--text-muted);
  margin: 6px 0 0;
}

.nav-menu {
  display: grid;
  gap: 8px;
}

.nav-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  transform: translateX(2px);
}

.nav-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  border-color: transparent;
}

.sidebar-actions {
  display: grid;
  gap: 9px;
  margin-top: auto;
}

.auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.87rem;
}

.main-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.topbar {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.version-line {
  font-size: 0.84rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.page {
  display: none;
  padding: 16px;
  min-height: 72vh;
}

.page.page-active {
  display: block;
  animation: riseIn 0.3s ease both;
}

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

.mtop {
  margin-top: 14px;
}

.inline-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-tools input {
  min-width: 240px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  box-shadow: 0 10px 20px rgba(10, 87, 77, 0.24);
}

.btn.accent {
  background: linear-gradient(135deg, #d97706, var(--accent-deep));
  color: #fff;
  box-shadow: 0 10px 20px rgba(160, 88, 16, 0.24);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-main);
}

.btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.28);
}

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

.stat-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.62);
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.stat-value {
  font-weight: 700;
  font-size: 1.24rem;
  margin-top: 4px;
}

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

.home-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.65);
}

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

.callback-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

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

.mini-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.72);
}

.order-list {
  display: grid;
  gap: 10px;
  max-height: 75vh;
  overflow: auto;
  padding-right: 2px;
}

.pager {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pager .pager-info {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.pager select {
  width: auto;
  min-width: 84px;
}

.order-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.order-head {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px dashed var(--line);
}

.order-id {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.order-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.order-step-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
  border: 1px solid transparent;
}

.badge.wm-4,
.badge.success {
  color: #0b6b40;
  background: rgba(19, 140, 83, 0.14);
  border-color: rgba(19, 140, 83, 0.34);
}

.badge.failed {
  color: #9c2c21;
  background: rgba(208, 65, 51, 0.12);
  border-color: rgba(208, 65, 51, 0.3);
}

.badge.ordered,
.badge.pending {
  color: #8b4800;
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.3);
}

.badge.purchased {
  color: #0f7668;
  background: rgba(15, 118, 104, 0.12);
  border-color: rgba(15, 118, 104, 0.3);
}

.order-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.order-items th,
.order-items td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(24, 42, 39, 0.08);
  text-align: left;
  vertical-align: top;
}

.cell-lines {
  display: grid;
  gap: 4px;
}

.seq-no {
  color: var(--text-muted);
  margin-right: 2px;
}

.order-items tr:last-child td {
  border-bottom: none;
}

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

label {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.hint {
  font-size: 0.78rem;
  color: #6a7f79;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.92rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.82);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(15, 118, 104, 0.52);
  box-shadow: 0 0 0 4px rgba(15, 118, 104, 0.12);
}

.mapping-flow-native {
  display: none;
}

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

.flow-select-modal-body {
  display: grid;
  gap: 10px;
}

.flow-select-list {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
}

.flow-select-option {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(24, 42, 39, 0.08);
  background: transparent;
  color: var(--text-main);
  text-align: left;
  padding: 10px;
  cursor: pointer;
  font-size: 0.92rem;
}

.flow-select-option:last-child {
  border-bottom: 0;
}

.flow-select-option:hover,
.flow-select-option.active {
  background: rgba(15, 118, 104, 0.12);
}

.flow-select-empty {
  padding: 12px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

.full-row {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
}

.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 0.86rem;
}

th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(24, 42, 39, 0.08);
}

thead {
  background: rgba(245, 224, 189, 0.45);
}

.actions {
  display: flex;
  gap: 6px;
}

.log-payload {
  max-width: 460px;
}

.log-payload-inline {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-payload-head {
  display: flex;
  align-items: center;
  gap: 3px;
}

.log-payload-head .log-payload-inline {
  flex: 1;
  min-width: 0;
}

.log-ellipsis {
  color: var(--text-muted);
  line-height: 1;
}

.log-payload-full {
  margin: 8px 0 0;
  padding: 8px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.log-toggle-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.log-mini-toggle {
  padding: 0 5px;
  min-width: 24px;
  line-height: 1;
  font-size: 0.8rem;
}

.text-link {
  color: var(--primary-deep);
  text-decoration: underline;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 35, 31, 0.45);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal.show {
  display: flex;
}

.modal-card {
  width: min(900px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 14px;
}

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

.detail-modal-card {
  width: min(1100px, 98vw);
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.detail-kv {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.62);
}

.detail-kv strong {
  display: block;
  margin-top: 4px;
}

.item-link-row td {
  background: rgba(15, 118, 104, 0.04);
}

.item-link-box {
  border: 1px dashed rgba(15, 118, 104, 0.32);
  border-radius: 10px;
  padding: 8px;
}

.item-link-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.item-link-wrap {
  overflow: auto;
}

.item-link-table {
  min-width: 560px;
  font-size: 0.82rem;
  border-collapse: collapse;
}

.item-link-table th,
.item-link-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(24, 42, 39, 0.08);
  vertical-align: top;
}

.item-link-table thead {
  background: rgba(245, 224, 189, 0.4);
}

.empty {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  background: rgba(24, 42, 39, 0.95);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.rise {
  animation: riseIn 0.45s ease both;
  animation-delay: var(--delay, 0s);
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-actions {
    margin-top: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .detail-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    padding: 10px;
  }

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

  .topbar-actions,
  .nav-menu,
  .sidebar-actions {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .inline-tools {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .inline-tools input {
    min-width: 0;
  }

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

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

  .modal-card {
    width: 100%;
    max-height: 94vh;
  }
}
