:root {
  --ink: #202124;
  --muted: #686f78;
  --line: #dfe3e8;
  --paper: #f7f5ef;
  --panel: #ffffff;
  --panel-soft: #f2f7f4;
  --green: #2f7d5c;
  --green-dark: #1f5f45;
  --coral: #c45f4a;
  --amber: #b9892e;
  --blue: #466f9f;
  --violet: #7661a9;
  --shadow: 0 18px 42px rgba(36, 40, 44, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
  height: 100vh;
  padding: 24px;
  background: #22332d;
  color: #f7fbf8;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #e5b75c;
  color: #1e2a25;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: rgba(247, 251, 248, 0.72);
  font-size: 13px;
}

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

.nav-item {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(247, 251, 248, 0.78);
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.sidebar-section,
.erp-preview {
  display: grid;
  gap: 10px;
}

.section-label,
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar .section-label {
  color: rgba(247, 251, 248, 0.62);
}

.field-label {
  color: rgba(247, 251, 248, 0.74);
  font-size: 13px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

select,
input {
  min-height: 40px;
  padding: 0 12px;
}

textarea {
  padding: 11px 12px;
  resize: vertical;
}

.sidebar select {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.erp-chip {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(247, 251, 248, 0.88);
  font-size: 13px;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.08;
}

h2,
h3 {
  margin: 0;
}

.topbar-actions,
.panel-title-row,
.card-title-row,
.detail-header,
.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.primary-button {
  background: var(--green);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--green-dark);
}

.secondary-button {
  border-color: #c9d4cf;
  background: #eef6f1;
  color: var(--green-dark);
}

.ghost-button {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.small {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.full {
  width: 100%;
}

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

.metrics article {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metrics span,
.product-meta,
.dropzone span,
.image-card textarea,
.version-item p {
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.board-detail-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(560px, 1.28fr);
  gap: 18px;
  align-items: start;
}

.board-panel,
.detail-panel,
.rail-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.board-panel,
.detail-panel {
  min-width: 0;
  padding: 18px;
}

.compact {
  margin-bottom: 14px;
}

.panel-title-row {
  margin-bottom: 16px;
}

.board-panel .panel-title-row {
  align-items: stretch;
  flex-direction: column;
}

.panel-title-row input {
  max-width: 260px;
}

.board-panel .panel-title-row input {
  max-width: none;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.kanban-column {
  min-width: 190px;
  border-radius: 8px;
  background: #f5f6f2;
  padding: 10px;
}

.kanban-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #4c535b;
  font-size: 13px;
  font-weight: 800;
}

.product-card {
  display: grid;
  width: 100%;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0;
  border: 1px solid #e2e4df;
  border-radius: 8px;
  background: #ffffff;
  color: inherit;
  text-align: left;
  overflow: hidden;
}

.product-card.active {
  outline: 2px solid var(--green);
}

.product-thumb {
  width: 100%;
  aspect-ratio: 1.75;
  object-fit: cover;
  background: #e8e2d5;
}

.product-card-body {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.product-title {
  min-width: 0;
  font-size: 15px;
}

.card-progress {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.product-meta {
  margin: 0;
}

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

.tag {
  padding: 4px 7px;
  border-radius: 999px;
  background: #edf1ef;
  color: #4f5d56;
  font-size: 12px;
}

.detail-panel {
  position: sticky;
  top: 18px;
}

.detail-header {
  margin-bottom: 16px;
}

.status-pill {
  padding: 7px 10px;
  border-radius: 999px;
  background: #e8f4ee;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
}

.stage-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(78px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.stage-button {
  position: relative;
  min-height: 58px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #4c535b;
  text-align: left;
}

.stage-button::before {
  content: "";
  display: block;
  width: 9px;
  height: 9px;
  margin-bottom: 6px;
  border-radius: 999px;
  background: #c9d2d8;
}

.stage-button.done::before {
  background: var(--green);
}

.stage-button.active {
  border-color: var(--green);
  background: #eef8f2;
  color: var(--green-dark);
  font-weight: 800;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 16px;
  align-items: start;
}

.stage-content,
.right-rail {
  min-width: 0;
}

.dropzone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 96px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px dashed #9bb8a9;
  border-radius: 8px;
  background: var(--panel-soft);
}

.dropzone.dragging {
  border-color: var(--green);
  background: #e2f3e9;
}

.dropzone strong,
.dropzone span {
  display: block;
}

.dropzone span {
  margin-top: 5px;
}

.image-wall {
  column-count: 2;
  column-gap: 12px;
}

.image-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 12px;
  break-inside: avoid;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.image-card img {
  display: block;
  width: 100%;
  min-height: 140px;
  object-fit: cover;
}

.image-card textarea {
  min-height: 66px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.notes {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.note {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--coral);
  border-radius: 8px;
  background: #fffaf6;
}

.note p {
  margin: 4px 0 0;
  color: #555b61;
  font-size: 14px;
}

.right-rail {
  display: grid;
  gap: 12px;
}

.rail-section {
  padding: 14px;
  box-shadow: none;
}

.rail-heading {
  margin-bottom: 12px;
}

.rail-heading span {
  color: var(--green-dark);
  font-weight: 800;
}

.erp-form {
  display: grid;
  gap: 10px;
}

.erp-row {
  display: grid;
  gap: 6px;
}

.erp-row label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.version-list {
  display: grid;
  gap: 8px;
}

.version-item {
  padding: 10px;
  border-radius: 8px;
  background: #f6f3ea;
}

.version-item strong,
.version-item p {
  display: block;
  margin: 0;
}

.version-item p {
  margin-top: 4px;
}

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

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

  .board-detail-layout,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

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

@media (max-width: 820px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .panel-title-row,
  .detail-header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

  .kanban {
    grid-template-columns: repeat(3, 240px);
  }

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

  .image-wall {
    column-count: 1;
  }

  .dropzone {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .metrics,
  .right-rail,
  .topbar-actions {
    grid-template-columns: 1fr;
  }
}
