:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --line: rgba(0, 0, 0, 0.09);
  --line-strong: rgba(0, 0, 0, 0.14);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --soft: #86868b;
  --accent: #0071e3;
  --accent-soft: #e8f2ff;
  --green: #2f7d55;
  --orange: #b45f16;
  --radius: 14px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.topbar {
  min-height: 88px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 520px) auto auto;
  align-items: center;
  gap: 12px;
  padding: 18px 28px;
  background: rgba(245, 245, 247, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
  font-weight: 700;
}

#subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.search-wrap {
  width: 100%;
}

#searchInput {
  width: 100%;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 14px;
  background: rgba(232, 232, 237, 0.8);
  color: var(--text);
  outline: none;
}

#searchInput:focus {
  border-color: rgba(0, 113, 227, 0.35);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.08);
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(420px, 1fr) 430px;
  gap: 1px;
  height: calc(100vh - 88px);
  min-height: 640px;
  padding: 0 24px 24px;
}

.sidebar,
.content,
.detail-panel {
  min-height: 0;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.sidebar {
  border-radius: var(--radius) 0 0 var(--radius);
  padding: 18px 14px;
}

.content {
  border-left: 0;
  border-right: 0;
  padding: 18px 0;
}

.detail-panel {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.metric {
  padding: 10px 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.64);
}

.metric span,
.eyebrow,
.meta,
.field-label {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  font-weight: 650;
}

.section-title {
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.section-heading {
  margin: 18px 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mini-link {
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  padding: 4px 9px;
  cursor: pointer;
}

.category-list,
.region-list {
  display: flex;
  flex-direction: column;
}

.category-item {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 10px 9px;
  text-align: left;
  cursor: pointer;
}

.category-item:hover,
.category-item.active {
  background: rgba(0, 113, 227, 0.08);
}

.category-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  max-width: 100%;
}

.category-name {
  font-weight: 650;
}

.category-stats {
  margin-top: 5px;
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.subcategory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.subcategory-chip,
.region-chip {
  border: 0;
  border-radius: 999px;
  background: rgba(232, 232, 237, 0.8);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.region-chip {
  margin: 3px 0;
  text-align: left;
  width: fit-content;
}

.subcategory-chip.active,
.region-chip.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px 14px;
  border-bottom: 1px solid var(--line);
}

.insight-block {
  min-height: 164px;
  background: rgba(255, 255, 255, 0.58);
  display: grid;
  grid-template-columns: 106px 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
}

.donut {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background: #fff;
}

.donut span {
  position: relative;
  z-index: 1;
  font-size: 24px;
  font-weight: 700;
}

.insight-copy {
  min-width: 0;
}

.legend-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.legend-item {
  width: 100%;
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 8px;
  cursor: pointer;
}

.legend-item:hover,
.legend-item.active {
  background: rgba(0, 113, 227, 0.08);
}

.legend-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-item strong {
  font-weight: 650;
}

.toolbar h2 {
  font-size: 21px;
  font-weight: 700;
}

.icon-button,
.primary-button {
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.icon-button:hover {
  background: #fff;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.danger-button {
  color: #b42318;
}

.danger-button:hover {
  background: #fff0ee;
}

.supplier-grid {
  display: flex;
  flex-direction: column;
}

.supplier-card {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 20px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease;
}

.supplier-card:hover,
.supplier-card.active {
  background: rgba(0, 113, 227, 0.06);
  box-shadow: inset 3px 0 0 var(--accent);
}

.supplier-name {
  font-size: 16px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 9px 0 7px;
}

.tag {
  border-radius: 999px;
  background: rgba(232, 232, 237, 0.78);
  color: #424245;
  padding: 3px 8px;
  font-size: 12px;
}

.tag.hot {
  background: #fff2e5;
  color: var(--orange);
}

.card-line {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.empty-detail {
  display: grid;
  place-content: center;
  height: 100%;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.empty-detail h2 {
  color: var(--text);
  margin-bottom: 8px;
}

.detail-header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(14px);
}

.detail-header h2 {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 720;
  overflow-wrap: anywhere;
}

.detail-content {
  padding: 18px 22px 28px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
  border-top: 1px solid var(--line);
}

.field {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  min-width: 0;
}

.field.wide,
.wide {
  grid-column: 1 / -1;
}

.field-value {
  margin-top: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.choice-chip {
  border: 0;
  border-radius: 999px;
  background: rgba(232, 232, 237, 0.8);
  color: var(--text);
  min-height: 30px;
  padding: 0 11px;
  cursor: pointer;
}

.choice-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.upload-box {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
}

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

.helper-box p {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.upload-grid,
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.upload-grid input,
.upload-grid select,
.upload-grid textarea,
.edit-grid input,
.edit-grid select,
.edit-grid textarea,
.form-content input,
.form-content select,
.form-content textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  padding: 8px 10px;
  color: var(--text);
  outline: none;
}

.upload-grid textarea,
.upload-grid .file-row,
.upload-grid .actions {
  grid-column: 1 / -1;
}

.edit-grid label,
.form-content label,
.form-choice {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

summary {
  cursor: pointer;
  color: var(--text);
}

.drop-zone {
  grid-column: 1 / -1;
  min-height: 108px;
  border: 1.5px dashed rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  background: rgba(245, 245, 247, 0.72);
  display: grid;
  place-items: center;
  padding: 14px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
}

.drop-zone strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.attachment-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.attachment-item {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  background: transparent;
}

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

.attachment-title {
  font-weight: 650;
  overflow-wrap: anywhere;
}

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

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

#previewModal {
  z-index: 40;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.modal-body {
  position: relative;
  width: min(1100px, calc(100vw - 32px));
  height: min(780px, calc(100vh - 32px));
  margin: 16px auto;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.form-modal {
  width: min(760px, calc(100vw - 32px));
  height: auto;
  max-height: min(760px, calc(100vh - 32px));
}

#editModalContent {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.edit-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.edit-form-content {
  flex: 1;
  min-height: 0;
}

.modal-actions {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.dashboard-modal {
  width: min(1180px, calc(100vw - 32px));
}

.files-modal {
  width: min(1280px, calc(100vw - 32px));
}

.dashboard-content {
  overflow: auto;
  padding: 0;
}

.files-content {
  overflow: auto;
  padding: 16px;
}

.files-upload {
  margin-bottom: 16px;
}

.file-upload-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  padding: 14px;
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--line);
}

.file-column {
  min-height: 360px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.file-column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.file-column-list .attachment-item {
  padding: 12px 0;
}

.dashboard-category {
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

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

.dashboard-category-head h4 {
  margin: 3px 0 0;
  font-size: 20px;
}

.dashboard-category-head strong {
  font-size: 16px;
}

.dashboard-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.modal-head {
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.modal-head h3 {
  font-size: 17px;
}

.form-content {
  padding: 16px;
  overflow: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.preview-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.preview-content iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.preview-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: auto;
}

.sheet-preview {
  border-collapse: collapse;
  min-width: 100%;
  font-size: 13px;
  background: #fff;
}

.sheet-preview td,
.sheet-preview th {
  border: 1px solid var(--line);
  padding: 6px 8px;
  vertical-align: top;
  white-space: pre-wrap;
}

.sheet-preview tr:first-child {
  background: #f5f5f7;
  font-weight: 650;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr 1fr auto;
  }

  #addSupplierBtn {
    grid-column: 3;
  }

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

  .detail-panel {
    grid-column: 1 / -1;
    min-height: 520px;
    border-radius: var(--radius);
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 16px;
  }

  .layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    padding: 0 12px 16px;
  }

  .sidebar,
  .content,
  .detail-panel {
    border-radius: var(--radius);
    max-height: none;
  }

  .content {
    border: 1px solid var(--line);
  }

  .dashboard-charts,
  .files-grid,
  .insight-block {
    grid-template-columns: 1fr;
  }

  .donut {
    margin: 0 auto;
  }

  .field-grid,
  .upload-grid,
  .edit-grid,
  .form-content {
    grid-template-columns: 1fr;
  }
}

/* Apple-like compact refinements */
.topbar {
  min-height: 72px;
  padding: 12px 24px;
}

h1 {
  font-size: 21px;
}

#subtitle {
  margin-top: 4px;
  font-size: 12px;
}

.layout {
  height: calc(100vh - 72px);
  min-height: 560px;
  padding: 0 18px 18px;
  grid-template-columns: 250px minmax(420px, 1fr) 410px;
}

.sidebar {
  padding: 14px 12px;
}

.content {
  padding: 12px 0;
}

.metric-grid {
  margin-bottom: 12px;
}

.metric {
  padding: 8px 9px;
  background: transparent;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.metric strong {
  font-size: 18px;
}

.category-item {
  padding: 8px 8px;
}

.toolbar {
  padding: 0 16px 10px;
}

.toolbar h2 {
  font-size: 19px;
}

.supplier-card {
  padding: 11px 16px;
}

.supplier-name {
  font-size: 15px;
}

.tags {
  margin: 6px 0;
}

.detail-header {
  padding: 16px 18px 12px;
}

.detail-header h2 {
  font-size: 21px;
}

.detail-content {
  padding: 12px 18px 22px;
}

.field-grid {
  gap: 0 16px;
}

.field {
  padding: 9px 0;
}

.field-value {
  font-size: 14px;
}

.detail-actions {
  margin: 12px 0;
}

.upload-box,
.helper-box,
.file-upload-panel {
  margin: 12px 0;
  padding: 12px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.upload-grid,
.edit-grid {
  margin-top: 10px;
  gap: 8px;
}

.drop-zone {
  min-height: 78px;
  border-radius: 10px;
  background: rgba(245, 245, 247, 0.58);
}

.choice-group {
  margin-top: 10px;
}

.choice-label {
  color: var(--soft);
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 6px;
}

.choice-list {
  margin-top: 0;
  gap: 6px;
}

.choice-chip {
  min-height: 28px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.choice-chip.active {
  background: var(--accent);
  color: #fff;
}

.selected-list {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.empty-note {
  color: var(--soft);
  font-size: 13px;
  line-height: 28px;
}

.modal-body {
  border-radius: 16px;
}

.form-content {
  gap: 10px;
}

.files-content {
  padding: 12px;
}

.file-column {
  min-height: 300px;
  padding: 10px;
}

@media (max-width: 1320px) {
  .topbar {
    grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1fr) auto auto;
    gap: 10px;
    padding: 12px 18px;
  }

  .layout {
    grid-template-columns: 220px minmax(300px, 1fr) 360px;
    padding: 0 12px 12px;
  }

  .detail-header {
    padding: 14px 16px 10px;
  }

  .detail-content {
    padding: 10px 16px 18px;
  }

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

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr);
  }

  .search-wrap {
    grid-column: 2;
  }

  #bulkBtn,
  #addSupplierBtn {
    width: 100%;
  }

  .layout {
    grid-template-columns: minmax(280px, 36%) minmax(420px, 1fr);
    grid-template-areas:
      "filters filters"
      "list detail";
    height: auto;
    min-height: 0;
    align-items: start;
  }

  .sidebar {
    grid-area: filters;
    border-radius: var(--radius);
    max-height: 156px;
    display: grid;
    grid-template-columns: 168px 116px minmax(260px, 1fr) 210px;
    grid-template-areas: "metrics board categories regions";
    align-items: stretch;
    gap: 10px;
    overflow: auto;
  }

  .content {
    grid-area: list;
    min-height: 620px;
    border-right: 1px solid var(--line);
    border-radius: var(--radius) 0 0 var(--radius);
  }

  .detail-panel {
    grid-area: detail;
    min-height: 620px;
    border-radius: 0 var(--radius) var(--radius) 0;
  }

  .metric-grid {
    grid-area: metrics;
    margin-bottom: 0;
    align-self: start;
  }

  .sidebar .section-heading {
    grid-area: board;
    margin-top: 0;
    margin-bottom: 0;
    min-height: 72px;
    align-self: start;
    justify-content: center;
    flex-direction: column;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .sidebar > .section-title {
    display: none;
  }

  .category-list {
    grid-area: categories;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(138px, 160px);
    gap: 8px;
    max-height: 114px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
  }

  .category-item {
    min-height: 90px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.5);
  }

  .category-item.active {
    box-shadow: inset 0 -3px 0 var(--accent);
  }

  .category-stats,
  .category-item .subcategory-list {
    display: none;
  }

  .region-list {
    grid-area: regions;
    align-content: start;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 114px;
    overflow: auto;
    padding-left: 2px;
  }

  .region-chip {
    margin: 0;
  }
}

@media (max-width: 760px) {
  body {
    overflow-x: auto;
  }

  #app {
    min-width: 720px;
  }

  .topbar {
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr);
    align-items: stretch;
    padding: 14px;
  }

  .search-wrap {
    grid-column: 2;
  }

  #bulkBtn {
    grid-column: 1;
  }

  #addSupplierBtn {
    grid-column: 2;
  }

  .layout {
    display: grid;
    grid-template-columns: 270px 1fr;
    grid-template-areas:
      "filters filters"
      "list detail";
    gap: 10px;
    padding: 0 10px 12px;
  }

  .sidebar {
    grid-template-columns: 148px 100px minmax(220px, 1fr) 180px;
    border-radius: var(--radius);
  }

  .content {
    border-radius: var(--radius) 0 0 var(--radius);
  }

  .detail-panel {
    border-radius: 0 var(--radius) var(--radius) 0;
  }

  .metric-grid,
  .field-grid,
  .upload-grid,
  .form-content {
    grid-template-columns: 1fr;
  }

  .modal-body,
  .form-modal,
  .dashboard-modal,
  .files-modal {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    max-height: none;
    margin: 10px auto;
  }

  .files-grid,
  .dashboard-charts,
  .insight-block {
    grid-template-columns: 1fr;
  }
}

/* Refined compact detail system */
.detail-panel {
  background: rgba(255, 255, 255, 0.9);
}

.detail-header {
  background: rgba(255, 255, 255, 0.88);
}

.detail-header .tags,
.supplier-card .tags {
  gap: 5px;
}

.tag {
  background: rgba(232, 232, 237, 0.72);
  color: #515154;
  padding: 2px 7px;
  font-size: 12px;
}

.tag.hot {
  background: #fff4e8;
  color: #a35412;
}

.field-grid {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.field {
  padding: 8px 0;
}

.field-label {
  font-size: 12px;
}

.field-value {
  margin-top: 3px;
  font-size: 14px;
}

.detail-actions {
  margin: 10px 0 6px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
}

.section-head strong {
  font-size: 13px;
  color: var(--muted);
  font-weight: 650;
}

.taxonomy-bar,
.compact-upload {
  margin: 12px 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
}

.taxonomy-row {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.taxonomy-bar .choice-list {
  margin: 0;
  gap: 5px;
}

.taxonomy-bar .selected-list {
  padding: 0;
  border: 0;
}

.taxonomy-bar .available-list {
  max-height: 34px;
  overflow: hidden;
}

.taxonomy-bar .available-list:hover,
.taxonomy-bar:focus-within .available-list {
  max-height: 96px;
  overflow: auto;
}

.choice-chip {
  min-height: 26px;
  padding: 0 9px;
  font-size: 12px;
  background: rgba(232, 232, 237, 0.72);
  color: #5d5d62;
}

.choice-chip.active {
  background: rgba(0, 113, 227, 0.12);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(0, 113, 227, 0.18);
}

.taxonomy-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
}

.taxonomy-add input {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(245, 245, 247, 0.72);
  padding: 6px 10px;
  outline: none;
}

.compact-upload-grid {
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.compact-upload-grid input[name="note"] {
  grid-column: 1 / -1;
}

.compact-upload-grid .drop-zone {
  grid-column: 1 / -1;
  min-height: 42px;
  border-style: solid;
  border-radius: 10px;
  background: rgba(245, 245, 247, 0.7);
}

.compact-upload-grid .drop-zone span {
  font-size: 13px;
}

.compact-upload-grid .drop-zone strong {
  display: inline;
  margin: 0 6px 0 0;
}

.compact-upload-grid .actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.attachment-list {
  border-top-color: var(--line);
}

.attachment-item {
  padding: 9px 0;
}

.attachment-title {
  font-size: 14px;
}

.attachment-actions {
  gap: 6px;
  margin-top: 7px;
}

.attachment-actions .icon-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.file-upload-panel {
  padding: 0;
}

.mobile-detail-close {
  display: none;
  margin-bottom: 10px;
}

/* DingTalk workspace polish */
html,
body {
  min-height: 100%;
}

body {
  overflow: hidden;
}

#app {
  min-width: 1040px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  flex: 0 0 auto;
  min-height: 76px;
  grid-template-columns: minmax(280px, 0.85fr) minmax(340px, 1fr) auto auto;
  gap: 10px;
  padding: 12px 22px;
  background: rgba(246, 246, 248, 0.94);
}

.topbar h1 {
  font-size: 22px;
  letter-spacing: 0;
}

#subtitle {
  color: #7a7a80;
}

#searchInput {
  height: 38px;
  border-radius: 12px;
  background: rgba(232, 232, 237, 0.72);
  font-size: 14px;
}

.icon-button,
.primary-button {
  min-height: 34px;
  border-radius: 11px;
  padding: 0 13px;
  font-size: 14px;
}

#addSupplierBtn {
  border-radius: 14px;
  min-width: 104px;
}

.layout {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 238px minmax(390px, 0.95fr) minmax(390px, 1.05fr);
  gap: 0;
  padding: 10px 14px 14px;
  overflow: hidden;
}

.sidebar,
.content,
.detail-panel {
  min-height: 0;
  max-height: none;
  border-color: rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.88);
}

.sidebar {
  display: flex;
  flex-direction: column;
  grid-area: auto;
  overflow: hidden;
  padding: 12px;
  border-radius: 16px 0 0 16px;
}

.content {
  grid-area: auto;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.detail-panel {
  grid-area: auto;
  border-radius: 0 16px 16px 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.metric-grid {
  flex: 0 0 auto;
  grid-area: auto;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 0 10px;
  border-bottom: 1px solid var(--line);
}

.metric {
  padding: 5px 2px 10px;
  border: 0;
  background: transparent;
}

.metric + .metric {
  padding-left: 14px;
}

.metric span,
.section-title,
.section-head strong,
.eyebrow,
.field-label {
  color: #77777d;
  font-size: 12px;
  font-weight: 600;
}

.metric strong {
  margin-top: 2px;
  font-size: 19px;
  letter-spacing: 0;
}

.sidebar .section-heading {
  grid-area: auto;
  min-height: 0;
  align-self: auto;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  margin: 2px 0 8px;
  padding: 0;
  border: 0;
}

.mini-link {
  min-height: 24px;
  border-radius: 8px;
  padding: 0 8px;
  background: rgba(0, 113, 227, 0.1);
}

.category-list {
  flex: 1 1 auto;
  grid-area: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: none;
  overflow: auto;
  padding: 0;
}

.category-item {
  min-height: 0;
  border-radius: 0;
  padding: 10px 2px;
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.065);
}

.category-item:hover,
.category-item.active {
  background: transparent;
  box-shadow: none;
}

.category-item.active .category-name {
  color: var(--accent);
}

.category-item.active {
  box-shadow: inset 3px 0 0 var(--accent);
  padding-left: 10px;
}

.category-row {
  min-height: 22px;
}

.category-name {
  font-size: 14px;
  font-weight: 650;
}

.category-row strong {
  color: #3f3f44;
  font-size: 13px;
}

.category-stats {
  display: none;
}

.subcategory-list {
  margin-top: 6px;
  gap: 4px;
  max-height: 24px;
  overflow: hidden;
}

.subcategory-chip,
.region-chip,
.tag {
  border-radius: 8px;
  padding: 2px 7px;
  font-size: 12px;
  background: rgba(232, 232, 237, 0.72);
}

.sidebar > .section-title {
  display: block;
  flex: 0 0 auto;
  margin: 10px 0 7px;
}

.region-list {
  flex: 0 0 auto;
  grid-area: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 58px;
  overflow: auto;
  padding: 0 0 1px;
}

.region-chip {
  width: auto;
  margin: 0;
}

.toolbar {
  flex: 0 0 auto;
  min-height: 70px;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.72);
}

.toolbar h2 {
  font-size: 20px;
}

.supplier-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.supplier-card {
  padding: 12px 16px;
}

.supplier-card.active {
  background: rgba(0, 113, 227, 0.07);
  box-shadow: inset 3px 0 0 var(--accent);
}

.supplier-name {
  font-size: 15px;
}

.detail-header {
  flex: 0 0 auto;
  padding: 14px 18px 12px;
}

.detail-header h2 {
  font-size: 22px;
}

.detail-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px 18px 20px;
}

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

.field {
  padding: 9px 0;
}

.detail-actions {
  gap: 7px;
}

.taxonomy-bar .available-list {
  max-height: 30px;
}

.upload-box,
.helper-box,
.file-upload-panel {
  background: transparent;
}

.drop-zone {
  min-height: 46px;
}

@media (max-width: 1180px) {
  body {
    overflow-x: auto;
    overflow-y: hidden;
  }

  .topbar {
    grid-template-columns: 300px 1fr auto auto;
  }

  .search-wrap,
  #addSupplierBtn {
    grid-column: auto;
  }

  .layout {
    grid-template-columns: 230px 386px 424px;
    grid-template-areas: none;
  }

  .detail-panel {
    grid-column: auto;
    min-height: 0;
  }
}

@media (max-width: 760px) {
  #app {
    min-width: 1040px;
  }

  .topbar {
    grid-template-columns: 300px 1fr auto auto;
    padding: 12px 18px;
  }

  .search-wrap,
  #bulkBtn,
  #addSupplierBtn {
    grid-column: auto;
  }

  .layout {
    display: grid;
    grid-template-columns: 230px 386px 424px;
    grid-template-areas: none;
    gap: 0;
    padding: 10px 14px 14px;
  }
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  #app {
    min-width: 0;
  }

  .topbar {
    position: sticky;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .search-wrap,
  #bulkBtn,
  #addSupplierBtn {
    grid-column: auto;
    width: 100%;
  }

  .layout {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    overflow: visible;
  }

  .sidebar,
  .content {
    border: 1px solid var(--line);
    border-radius: 14px;
  }

  .sidebar {
    max-height: 220px;
    overflow: auto;
  }

  .content {
    min-height: 58vh;
  }

  .supplier-grid {
    max-height: none;
  }

  .detail-panel {
    position: fixed;
    inset: 0;
    z-index: 18;
    display: none;
    border: 0;
    border-radius: 0;
    background: #fff;
  }

  body.detail-open .detail-panel {
    display: flex;
  }

  .mobile-detail-close {
    display: inline-flex;
    width: fit-content;
  }

  .detail-header {
    padding: 12px 14px;
  }

  .detail-content {
    padding: 10px 14px 24px;
  }

  .field-grid,
  .upload-grid,
  .form-content,
  .compact-upload-grid {
    grid-template-columns: 1fr;
  }
}

/* Responsive workspace v2: readable in DingTalk narrow windows */
@media (max-width: 1180px) and (min-width: 721px) {
  body {
    overflow: auto;
  }

  #app {
    min-width: 0;
    min-height: 100vh;
  }

  .topbar {
    position: sticky;
    top: 0;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    min-height: 0;
    padding: 12px 16px;
    gap: 10px;
  }

  .search-wrap {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  #bulkBtn,
  #addSupplierBtn {
    width: auto;
  }

  .layout {
    height: auto;
    min-height: calc(100vh - 128px);
    overflow: visible;
    display: grid;
    grid-template-columns: minmax(320px, 40%) minmax(420px, 1fr);
    grid-template-areas:
      "filters filters"
      "list detail";
    gap: 8px;
    padding: 8px 10px 12px;
    align-items: start;
  }

  .sidebar {
    grid-area: filters;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) minmax(180px, 0.34fr);
    gap: 8px;
    align-items: center;
    max-height: none;
    overflow: visible;
    border-radius: 15px;
    padding: 9px 10px;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0;
    border: 0;
    min-width: 132px;
  }

  .metric {
    padding: 0;
  }

  .metric + .metric {
    padding-left: 0;
  }

  .metric strong {
    font-size: 16px;
  }

  .sidebar .section-heading {
    margin: 0;
    justify-content: center;
    gap: 6px;
    min-width: 78px;
  }

  .category-list {
    display: flex;
    flex-direction: row;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0 3px;
    -webkit-overflow-scrolling: touch;
  }

  .category-item {
    flex: 0 0 auto;
    min-width: 0;
    max-width: none;
    padding: 7px 10px;
    border: 0;
    border-radius: 999px;
    background: rgba(245, 245, 247, 0.78);
  }

  .category-item.active {
    padding-left: 10px;
    background: rgba(0, 113, 227, 0.1);
    box-shadow: inset 0 0 0 1px rgba(0, 113, 227, 0.16);
  }

  .category-name {
    font-size: 13px;
    white-space: nowrap;
  }

  .category-row strong {
    font-size: 12px;
    color: #6e6e73;
    font-weight: 600;
  }

  .subcategory-list {
    display: none;
  }

  .sidebar > .section-title {
    display: none;
  }

  .region-list {
    max-height: 64px;
    overflow: auto;
    align-content: center;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
    padding-left: 8px;
    border-left: 1px solid var(--line);
  }

  .region-list::before {
    content: "地区";
    align-self: center;
    color: #77777d;
    font-size: 12px;
    font-weight: 600;
    margin-right: 2px;
  }

  .content {
    grid-area: list;
    min-height: calc(100vh - 220px);
    max-height: none;
    border: 1px solid var(--line);
    border-radius: 15px 0 0 15px;
  }

  .detail-panel {
    grid-area: detail;
    min-height: calc(100vh - 220px);
    max-height: none;
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 15px 15px 0;
  }

  .supplier-grid,
  .detail-content {
    max-height: calc(100vh - 300px);
    overflow: auto;
  }

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

/* v5 simplified workbench: one compact filter rail, faster scanning */
body {
  overflow: auto;
}

#app {
  min-width: 0;
}

.topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(260px, auto) minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
}

.topbar h1 {
  font-size: 20px;
  line-height: 1.15;
}

#subtitle {
  display: none;
}

.search-wrap {
  grid-column: auto;
  grid-row: auto;
}

#searchInput {
  height: 36px;
  border-radius: 12px;
  font-size: 14px;
}

.layout {
  height: auto;
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(320px, 40%) minmax(420px, 1fr);
  grid-template-areas:
    "filters filters"
    "list detail";
  gap: 8px;
  padding: 8px 10px 12px;
  overflow: visible;
  align-items: start;
}

.sidebar {
  grid-area: filters;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) minmax(180px, auto);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: visible;
}

.content {
  grid-area: list;
  min-height: calc(100vh - 158px);
  border: 1px solid var(--line);
  border-radius: 14px 0 0 14px;
}

.detail-panel {
  grid-area: detail;
  min-height: calc(100vh - 158px);
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 14px 14px 0;
}

.metric-grid {
  display: flex;
  gap: 12px;
  min-width: 122px;
  margin: 0;
  border: 0;
}

.metric {
  padding: 0;
  border: 0;
}

.metric + .metric {
  padding-left: 0;
}

.metric span {
  font-size: 11px;
}

.metric strong {
  font-size: 16px;
  margin-top: 1px;
}

.sidebar .section-heading {
  min-width: 72px;
  margin: 0;
  gap: 6px;
  justify-content: center;
}

.sidebar .section-title,
.category-list::before,
.region-list::before {
  color: #77777d;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.category-list::before {
  content: "大类";
  align-self: center;
}

.category-list {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1px 0 2px;
}

.category-item {
  width: auto !important;
  height: 28px;
  min-height: 28px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(232, 232, 237, 0.64);
  box-shadow: none;
}

.category-item.active,
.category-item:hover {
  padding-left: 9px;
  background: rgba(0, 113, 227, 0.1);
  box-shadow: inset 0 0 0 1px rgba(0, 113, 227, 0.18);
}

.category-row {
  min-height: 0;
  display: inline-flex;
  gap: 5px;
  white-space: nowrap;
}

.category-name,
.category-row strong,
.region-chip {
  font-size: 12px;
  line-height: 1;
}

.category-name {
  font-weight: 650;
}

.category-row strong {
  color: #77777d;
  font-weight: 600;
}

.category-stats,
.category-item .subcategory-list,
.sidebar > .section-title {
  display: none;
}

.region-list {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 360px;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.region-list::before {
  content: "地区";
  flex: 0 0 auto;
}

.region-chip {
  flex: 0 0 auto;
  height: 28px;
  display: inline-flex;
  align-items: center;
  width: auto;
  margin: 0;
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(232, 232, 237, 0.64);
  color: #515154;
  font-weight: 600;
}

.toolbar {
  min-height: 58px;
  padding: 10px 14px;
}

.toolbar h2 {
  font-size: 18px;
}

.supplier-grid,
.detail-content {
  max-height: calc(100vh - 228px);
  overflow: auto;
}

.supplier-card {
  padding: 10px 14px;
}

.supplier-name {
  font-size: 14px;
}

.tags {
  gap: 4px;
  margin: 5px 0;
}

.tag {
  font-size: 11px;
  padding: 2px 6px;
}

.card-line {
  font-size: 12px;
  line-height: 1.38;
}

.detail-header {
  padding: 12px 16px 10px;
}

.detail-header h2 {
  font-size: 20px;
  line-height: 1.25;
}

.detail-content {
  padding: 10px 16px 18px;
}

.field {
  padding: 7px 0;
}

.field-value {
  font-size: 13px;
}

@media (max-width: 980px) and (min-width: 721px) {
  .topbar {
    grid-template-columns: minmax(260px, 1fr) auto auto;
  }

  .search-wrap {
    grid-column: 1 / -1;
  }

  .layout {
    grid-template-columns: minmax(300px, 43%) minmax(360px, 1fr);
  }

  .sidebar {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "metrics board categories"
      "regions regions regions";
  }

  .metric-grid {
    grid-area: metrics;
  }

  .sidebar .section-heading {
    grid-area: board;
  }

  .category-list {
    grid-area: categories;
  }

  .region-list {
    grid-area: regions;
    max-width: none;
    padding: 5px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

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

  .layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .category-list,
  .region-list {
    max-width: none;
    overflow-x: auto;
  }

  .content {
    min-height: 0;
    border-radius: 14px;
  }

  .supplier-grid {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 900px) and (min-width: 721px) {
  .layout {
    grid-template-columns: minmax(290px, 44%) minmax(360px, 1fr);
    padding-left: 8px;
    padding-right: 8px;
  }

  .sidebar {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "metrics board categories"
      "regions regions regions";
    align-items: center;
  }

  .metric-grid {
    grid-area: metrics;
    min-width: 118px;
  }

  .sidebar .section-heading {
    grid-area: board;
  }

  .category-list {
    grid-area: categories;
  }

  .region-list {
    grid-area: regions;
    display: flex;
    max-height: 34px;
    padding-left: 0;
    border-left: 0;
    padding-top: 4px;
    border-top: 1px solid var(--line);
  }

  .supplier-card {
    padding: 10px 13px;
  }

  .detail-header h2 {
    font-size: 20px;
  }
}

@media (max-width: 720px) {
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .topbar {
    min-height: 0;
  }

  .layout {
    min-height: 0;
  }

  .sidebar {
    max-height: none;
    display: block;
  }

  .category-list {
    max-height: 230px;
    overflow: auto;
  }

  .content {
    min-height: auto;
  }

  .supplier-grid {
    overflow: visible;
  }
}

/* Unified compact filter chips */
@media (max-width: 1180px) and (min-width: 721px) {
  .category-list::before,
  .region-list::before {
    align-self: center;
    flex: 0 0 auto;
    color: #77777d;
    font-size: 12px;
    font-weight: 650;
    margin-right: 2px;
  }

  .category-list::before {
    content: "大类";
  }

  .category-list {
    align-items: center;
  }

  .category-item {
    width: auto !important;
    height: 30px;
    min-height: 30px;
    max-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0 10px;
    border-radius: 999px;
  }

  .category-row {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
  }

  .category-name,
  .category-row strong,
  .region-chip {
    font-size: 13px;
    line-height: 1;
  }

  .category-name {
    font-weight: 650;
  }

  .category-row strong {
    color: #77777d;
    font-weight: 600;
  }

  .region-list {
    align-items: center;
    align-content: center;
  }

  .region-chip {
    height: 30px;
    display: inline-flex;
    align-items: center;
    width: auto;
    padding: 0 10px;
    border-radius: 999px;
    color: #515154;
    background: rgba(232, 232, 237, 0.72);
    font-weight: 600;
  }
}
