:root {
  --bg: #eef3f1;
  --panel: #ffffff;
  --panel-soft: #f7faf9;
  --line: #dce6e2;
  --line-strong: #c7d6d0;
  --text: #111827;
  --muted: #667085;
  --muted-2: #8a96a3;
  --accent: #15b98d;
  --accent-dark: #0e7b61;
  --accent-soft: rgba(21, 185, 141, 0.12);
  --warning: #d97706;
  --danger: #dc2626;
  --sidebar: #0f6d52;
  --sidebar-dark: #0a5d46;
  --shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, "SF Pro Text", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #edf4f1 0%, #f6f8fb 48%, #eef2f6 100%);
  line-height: 1.55;
}

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

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, #158f6c 0%, var(--sidebar) 48%, var(--sidebar-dark) 100%);
  color: #fff;
  padding: 24px 0 18px;
  box-shadow: 12px 0 34px rgba(10, 93, 70, 0.18);
}

.brand {
  padding: 12px 24px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 10px;
}

.brand-sub {
  font-size: 15px;
  opacity: 0.92;
}

.nav {
  padding-top: 16px;
}

.nav-title {
  padding: 10px 20px 8px;
  font-size: 14px;
  opacity: 0.82;
  display: flex;
  justify-content: space-between;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px 11px 22px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(255, 255, 255, 0.11);
  border-left-color: rgba(255, 255, 255, 0.9);
  color: #fff;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  flex: none;
}

.main {
  padding: 16px 18px 22px;
  min-width: 0;
}

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

.crumbs {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.crumbs b {
  color: var(--text);
}

.avatar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  font-size: 14px;
}

.avatar span:first-child {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #70d4b7, #18a77d);
  font-weight: 800;
}

.page {
  display: grid;
  gap: 14px;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 18px 20px;
}

.hero-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.hero-title {
  display: grid;
  gap: 8px;
}

.hero-title h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.hero-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.hero-actions,
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  height: 38px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid #d4dfda;
  background: #fff;
  color: #344054;
  font-weight: 700;
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(180deg, #17be91, #0fa678);
  color: #fff;
  box-shadow: 0 10px 22px rgba(21, 185, 141, 0.2);
}

.btn.soft {
  background: var(--accent-soft);
  border-color: rgba(21, 185, 141, 0.22);
  color: var(--accent-dark);
}

.btn.danger {
  color: var(--danger);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.metric {
  border: 1px solid #e3ebe7;
  border-radius: 8px;
  background: #f8fbfa;
  padding: 11px 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.metric b {
  font-size: 17px;
}

.layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.column {
  min-width: 0;
  overflow: hidden;
}

.column-head {
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fafc, #f3f7f5);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.column-head h2,
.column-head h3 {
  margin: 0;
  font-size: 16px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.body {
  padding: 14px 16px 16px;
}

.search {
  position: relative;
  margin-bottom: 12px;
}

.search input,
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #d5ddd9;
  background: #fff;
  border-radius: 8px;
  outline: none;
}

.search input,
.field input,
.field select {
  height: 38px;
  padding: 0 11px;
}

.field textarea {
  min-height: 74px;
  padding: 9px 11px;
  resize: vertical;
}

.field label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

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

.list {
  display: grid;
  gap: 8px;
  max-height: 680px;
  overflow: auto;
  padding-right: 2px;
}

.row-card {
  border: 1px solid #e2e9e5;
  border-radius: 8px;
  background: #fff;
  padding: 11px;
  display: grid;
  gap: 8px;
}

.row-card.active {
  border-color: rgba(21, 185, 141, 0.42);
  box-shadow: 0 10px 22px rgba(21, 185, 141, 0.1);
  background: linear-gradient(180deg, rgba(21, 185, 141, 0.08), #fff);
}

.row-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.row-title {
  min-width: 0;
}

.row-title b {
  display: block;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-title span {
  color: var(--muted);
  font-size: 12px;
}

.pill,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef5f2;
  color: #426257;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.on {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.pill.warn {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}

.mini-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini {
  min-width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid #d8e2dd;
  background: #fff;
  color: #475467;
  font-weight: 800;
}

.workspace {
  display: grid;
  gap: 14px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid #d8e2dd;
  background: #fff;
  border-radius: 8px;
  padding: 8px 11px;
  color: #344054;
  font-weight: 800;
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(360px, 1.04fr);
  gap: 14px;
}

.attr-pool,
.selected-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.attr-category {
  border-top: 1px solid #edf2ef;
  padding: 10px 12px;
}

.attr-category:first-child {
  border-top: 0;
}

.attr-category h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.attr-item {
  border: 1px solid #e4ebe7;
  border-radius: 8px;
  padding: 9px;
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.attr-item.active {
  border-color: rgba(21, 185, 141, 0.44);
  background: rgba(21, 185, 141, 0.06);
}

.attr-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.attr-title b {
  font-size: 13px;
}

.attr-title span {
  color: var(--muted);
  font-size: 12px;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  border: 1px dashed #d4dfda;
  background: #fff;
  color: #53616f;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
}

.chip.active {
  border-style: solid;
  border-color: rgba(21, 185, 141, 0.48);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.selected-list {
  display: grid;
  gap: 8px;
  max-height: 500px;
  overflow: auto;
}

.selected-item {
  border: 1px solid #e2e9e5;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.selected-main {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.handle {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: #f2f5f4;
  color: #73808a;
  flex: none;
}

.empty {
  border: 1px dashed #cbd8d2;
  border-radius: 8px;
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
  background: #fbfdfc;
}

.preview {
  margin: 0;
  max-height: 270px;
  overflow: auto;
  border: 1px solid #dce6e1;
  border-radius: 8px;
  background: #101828;
  color: #d1fadf;
  padding: 12px;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 340px;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  border-radius: 8px;
  padding: 11px 13px;
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

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

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

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

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

  .sidebar {
    display: none;
  }

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

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