:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --line: #eaeaea;
  --line-soft: #f2f2f2;
  --ink: #111111;
  --ink-2: #52525b;
  --ink-3: #8e8e93;
  --ink-4: #b0b0b5;
  --accent-danger: #d92d20;
  --accent-danger-bg: #fef3f2;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

.hidden { display: none !important; }

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1480px;
  margin: 0 auto;
  height: 52px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
  flex-shrink: 0;
}

.app-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
  margin-right: 10px;
}

.nav-steps {
  display: inline-flex;
  align-items: center;
  background: #f2f2f4;
  padding: 2px;
  border-radius: 7px;
  gap: 2px;
  flex-shrink: 0;
}
.nav-step {
  border: none;
  background: transparent;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.14s;
  white-space: nowrap;
}
.nav-step:hover { color: var(--ink); }
.nav-step.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.count-pill {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
}

.divider-dot {
  color: #d4d4d8;
  font-size: 13px;
}

.company-name {
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
}

.sync-meta {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 6px;
  flex: 0 1 auto;
  min-width: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.topbar-actions .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Minimal Switch */
.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  margin-right: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}
.switch-control input { display: none; }
.switch-track {
  width: 28px;
  height: 16px;
  background: #e4e4e7;
  border-radius: 999px;
  position: relative;
  transition: background 0.18s ease;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: transform 0.18s ease;
}
.switch-control input:checked + .switch-track {
  background: var(--ink);
}
.switch-control input:checked + .switch-track::after {
  transform: translateX(12px);
}
.switch-label {
  font-size: 12px;
  color: var(--ink-2);
}

/* Buttons */
.btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.btn-solid {
  background: var(--ink);
  color: #ffffff;
  border: 1px solid var(--ink);
}
.btn-solid:hover { background: #27272a; }
.btn-solid:disabled { opacity: 0.45; cursor: default; }

.btn-ghost {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn-ghost:hover {
  color: var(--ink);
  border-color: #d4d4d8;
  background: #f8f8f8;
}
.btn-ghost:disabled { opacity: 0.4; cursor: default; }
.btn-xs { height: 27px; padding: 0 10px; }

.text-action {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--ink-3);
  cursor: pointer;
  padding: 2px 4px;
  white-space: nowrap;
  transition: color 0.12s;
}
.text-action:hover { color: var(--ink); }

/* Sync Bar */
.sync-bar {
  max-width: 1480px;
  margin: 12px auto 0;
  padding: 8px 28px;
  font-size: 12px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* Page Layout */
.page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Unified Hairline Metrics Strip */
.metrics-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-cell {
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}
.metric-cell:last-child { border-right: none; }

.metric-label {
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.dot-urgent { background: var(--accent-danger); }

.metric-val {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 6px 0 3px;
  line-height: 1.15;
}

.metric-foot {
  font-size: 11.5px;
  color: var(--ink-3);
}

/* Unified 3-Col Breakdown Strip */
.breakdown-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.breakdown-col {
  padding: 13px 18px;
  border-right: 1px solid var(--line);
}
.breakdown-col:last-child { border-right: none; }

.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}

.micro-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.micro-row {
  display: grid;
  grid-template-columns: 74px 1fr 112px;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  margin: 0 -6px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s;
}
.micro-row:hover { background: #f5f5f7; }
.micro-row.active { background: #f0f0f2; }

.micro-name {
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.micro-row.active .micro-name {
  color: var(--ink);
  font-weight: 600;
}

.micro-track {
  height: 4px;
  background: #f1f1f3;
  border-radius: 2px;
  overflow: hidden;
}

.micro-fill {
  height: 100%;
  background: #27272a;
  border-radius: 2px;
}
.micro-fill.urgent { background: var(--accent-danger); }
.micro-fill.muted { background: #a1a1aa; }

.micro-val {
  text-align: right;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
}
.micro-val em {
  font-style: normal;
  color: var(--ink-3);
  font-family: var(--sans);
  margin-left: 4px;
}

/* Main Workspace */
.workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

/* Segmented Control */
.segmented {
  display: inline-flex;
  background: #f4f4f5;
  padding: 2px;
  border-radius: 6px;
  gap: 1px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 4px 11px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.12s;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.filters-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box svg {
  position: absolute;
  left: 9px;
  color: var(--ink-3);
  pointer-events: none;
}
.search-box input {
  height: 30px;
  width: 185px;
  padding: 0 10px 0 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color 0.14s, background 0.14s;
}
.search-box input:focus {
  background: var(--surface);
  border-color: #a1a1aa;
}

.clean-select, .clean-input {
  height: 30px;
  padding: 0 24px 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-2);
  background-color: var(--surface);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  outline: none;
}
.clean-select:hover, .clean-input:focus {
  border-color: #bdbdc2;
  color: var(--ink);
}
.clean-input {
  background-image: none;
  padding: 0 10px;
  cursor: text;
  color: var(--ink);
}

.result-meta {
  padding: 9px 20px;
  font-size: 11.5px;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line-soft);
  background: #fcfcfc;
}

/* Minimal Table */
.table-container {
  overflow-x: auto;
}

.minimal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.minimal-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface);
  user-select: none;
}

.minimal-table th.sortable {
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}
.minimal-table th.sortable:hover {
  color: var(--ink);
  background: #f4f4f6;
}
.minimal-table th.sort-active {
  color: var(--ink);
  font-weight: 600;
}
.sort-mark {
  display: inline-block;
  width: 11px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  margin-left: 2px;
}
.sort-mark::before {
  content: "↕";
  opacity: 0.65;
}
.minimal-table th.sortable:hover .sort-mark {
  color: var(--ink-2);
}
.minimal-table th.sort-active .sort-mark {
  color: var(--ink);
}
.minimal-table th.sort-active .sort-mark::before {
  content: "";
}

.minimal-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink-2);
}

.minimal-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}
.minimal-table tbody tr:hover {
  background: #fafafa;
}

.num {
  text-align: right !important;
  font-family: var(--mono);
  font-size: 12px;
}

.empty-row {
  text-align: center;
  padding: 48px !important;
  color: var(--ink-3);
}

/* Priority Pill (Ultra-clean) */
.lvl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-2);
}
.lvl::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d4d4d8;
}
.lvl-P0 { color: var(--accent-danger); font-weight: 600; }
.lvl-P0::before { background: var(--accent-danger); }
.lvl-P1 { color: var(--ink); }
.lvl-P1::before { background: var(--ink); }
.lvl-P2::before { background: #71717a; }
.lvl-P3::before { background: #a1a1aa; }
.lvl-HEALTHY { color: var(--ink-3); }
.lvl-HEALTHY::before { background: #d4d4d8; }

/* Product Cell & Zoomable Thumbnail */
.prod-cell {
  display: flex;
  align-items: center;
  gap: 11px;
}
.prod-img-btn {
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 5px;
  background: #f1f1f3;
  border: 1px solid var(--line);
  flex-shrink: 0;
  overflow: hidden;
  cursor: zoom-in;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.14s, transform 0.14s, box-shadow 0.14s;
}
.prod-img-btn:hover {
  border-color: var(--ink);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.prod-img-btn::after {
  content: "+";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: rgba(17, 17, 17, 0.72);
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 12px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.12s;
  pointer-events: none;
}
.prod-img-btn:hover::after {
  opacity: 1;
}
.prod-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.prod-img-empty {
  width: 38px;
  height: 38px;
  border-radius: 5px;
  background: #f4f4f5;
  border: 1px dashed #d4d4d8;
  color: #a1a1aa;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
}
.sheet-head-main {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sheet-head-main .prod-img-btn,
.sheet-head-main .prod-img-empty {
  width: 46px;
  height: 46px;
  border-radius: 6px;
}
.prod-code {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.prod-name {
  font-size: 12px;
  color: var(--ink-3);
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wave-text {
  font-size: 12px;
  color: var(--ink-2);
}
.wave-old {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f4f4f5;
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
}
.sub-meta {
  font-size: 11px;
  color: var(--ink-3);
}

.val-strong {
  color: var(--ink);
  font-weight: 600;
}

.val-alert {
  color: var(--accent-danger);
}

.val-muted {
  color: var(--ink-3);
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.s-pill {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 4px;
  background: #f4f4f5;
  color: var(--ink-2);
  white-space: nowrap;
}
.s-pill.alert {
  background: var(--accent-danger-bg);
  color: var(--accent-danger);
}

/* Pager */
.pager {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-3);
}
.pager-actions { display: flex; gap: 6px; }

/* Sheet Drawer & Dialogs */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  z-index: 50;
}

.sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(620px, 94vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  z-index: 60;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.06);
}

.sheet-head, .dialog-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.sheet-code {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.sheet-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  margin-top: 3px;
}
.icon-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--ink-3);
  cursor: pointer;
  line-height: 1;
}
.icon-close:hover { color: var(--ink); }

.sheet-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sheet-advice {
  padding: 10px 14px;
  border-radius: 6px;
  background: #fafafa;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
}

.sheet-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.sheet-stat {
  padding: 11px 14px;
  border-right: 1px solid var(--line);
  min-height: 54px;
}
.sheet-stat:nth-child(3n),
.sheet-stat:last-child { border-right: none; }
.sheet-stat:nth-child(n + 4) { border-top: 1px solid var(--line); }
.sheet-stat span { font-size: 11px; color: var(--ink-3); display: block; }
.sheet-stat strong {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 4px;
  display: block;
}

.block-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
}

.sim-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.sim-inputs label span {
  display: block;
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 5px;
}
.sim-inputs input { width: 100%; font-family: var(--mono); }

.sim-summary {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 6px;
  background: #fafafa;
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Modal Dialog */
.modal-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: min(420px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.1);
}
.dialog-lg { width: min(640px, 94vw); }
.dialog-head h3 { font-size: 14px; font-weight: 600; }
.dialog-body { padding: 18px 24px; overflow-y: auto; }
.dialog-note { font-size: 12px; color: var(--ink-3); margin-bottom: 12px; }
.form-grid { display: flex; flex-direction: column; gap: 12px; }
.form-grid label span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 5px; }
.form-grid input { width: 100%; }

.wh-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}
.wh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.wh-row:hover { background: #fafafa; }

.dialog-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Floating Selection Bar */
.floating-bar {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  z-index: 40;
  font-size: 12.5px;
}
.floating-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-solid-light {
  background: #fff;
  color: var(--ink);
  border: none;
  height: 28px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-solid-light:hover { background: #f4f4f5; }

.btn-ghost-dark {
  background: rgba(255, 255, 255, 0.12);
  color: #f4f4f5;
  border: 1px solid rgba(255, 255, 255, 0.22);
  height: 28px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.btn-ghost-dark:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Minimalist Creation Preview Card Modal */
.collection-card-dialog {
  width: min(920px, 95vw) !important;
  max-height: 88vh !important;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.14);
}
.cc-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cc-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cc-head-left h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.cc-shop-picker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 9px;
  border-radius: 7px;
  background: #f6f6f8;
  border: 1px solid var(--line);
}
.cc-shop-label {
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
}
.cc-shop-select {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  outline: none;
  max-width: 290px;
  padding-right: 4px;
}
.cc-shop-shelf {
  font-size: 11px;
  color: var(--ink-3);
  padding-left: 7px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}
.cc-body {
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.cc-title-box {
  position: relative;
  display: flex;
  align-items: center;
}
.cc-title-input {
  width: 100%;
  height: 40px;
  padding: 0 64px 0 14px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fcfcfc;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  transition: border-color 0.14s, background 0.14s;
}
.cc-title-input:focus {
  background: #fff;
  border-color: var(--ink);
}
.cc-char-count {
  position: absolute;
  right: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  pointer-events: none;
}
.cc-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.cc-add-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 440px;
}
.cc-search-box {
  width: 100% !important;
}
.cc-search-box input {
  width: 100% !important;
}
.cc-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
  max-height: 260px;
  overflow-y: auto;
}
.cc-cand-row {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  font-size: 12px;
}
.cc-cand-row:last-child { border-bottom: none; }
.cc-cand-row:hover { background: #f8f8f9; }
.cc-cand-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.cc-batch-price {
  display: flex;
  align-items: center;
  gap: 7px;
}
.cc-list-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow-y: auto;
  max-height: 44vh;
  min-height: 160px;
}
.cc-table tbody tr {
  cursor: default;
}
.cc-loading-overlay {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 7px 14px;
  background: rgba(250, 250, 250, 0.94);
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cc-feedback {
  padding: 10px 14px;
  border-radius: 7px;
  background: #f8f8f9;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.55;
}
.cc-feedback.ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.cc-feedback.warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
.cc-feedback.err {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.s-pill.ok {
  background: #ecfdf5;
  color: #047857;
  font-weight: 600;
}
.s-pill.warn {
  background: #fffbeb;
  color: #b45309;
  font-weight: 500;
}
.cc-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.cc-foot-summary {
  font-size: 12.5px;
  color: var(--ink-2);
}
.cc-foot-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pass-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  margin-left: 6px;
}

/* Pool Controls & Inline Editors */
.pool-control-grid {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ctrl-title {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
}
.ctrl-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.inline-mono-input {
  width: 104px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  background: #fafafa;
  outline: none;
  transition: border-color 0.14s, background 0.14s;
}
.inline-mono-input:focus {
  background: #fff;
  border-color: var(--ink);
}

/* Collection Builder */
.shop-status-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.dot-ok { background: #10b981; }
.dot-warn { background: #f59e0b; }

.builder-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
  align-items: start;
}
.form-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.form-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field span {
  display: block;
  font-size: 11.5px;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.field input { width: 100%; }
.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.builder-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.publish-feedback {
  padding: 10px 12px;
  border-radius: 6px;
  background: #fafafa;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
}
.history-list {
  max-height: 220px;
  overflow-y: auto;
}
.hist-row {
  padding: 10px 20px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.hist-row:hover { background: #fafafa; }
.preview-body {
  padding: 16px 20px;
  max-height: 680px;
  overflow-y: auto;
}
.color-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.color-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: #fff;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 12.5px;
  z-index: 140;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Studio HD Image Lightbox */
.lightbox-overlay {
  z-index: 120;
  background: rgba(14, 14, 16, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-shell {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  color: #f4f4f5;
}
.lightbox-top {
  padding: 12px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: rgba(20, 20, 23, 0.72);
}
.lightbox-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.lightbox-pass {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: #ffffff;
  color: #111111;
}
.lightbox-code {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}
.lightbox-title {
  font-size: 13px;
  color: #d4d4d8;
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lightbox-sub {
  font-family: var(--mono);
  font-size: 12px;
  color: #a1a1aa;
}
.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lb-ctrl-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #e4e4e7;
  font-size: 12px;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.lb-ctrl-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.34);
  color: #ffffff;
}
.lb-ctrl-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.lb-zoom-val {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #d4d4d8;
  min-width: 44px;
  text-align: center;
}
.lb-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 4px;
}
.lb-close-btn {
  width: 30px;
  height: 30px;
  margin-left: 4px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.lb-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.lb-canvas {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.lb-main-img {
  max-width: min(86vw, 980px);
  max-height: calc(100vh - 178px);
  object-fit: contain;
  border-radius: 6px;
  /* 中性浅灰摄影底板，确保白底/透明底白色毛衣和深色大衣均清晰分明 */
  background: #f2f2f4;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  cursor: zoom-in;
  transition: transform 0.08s ease-out;
  transform-origin: center center;
}
.lb-main-img.is-zoomed {
  cursor: grab;
}
.lb-main-img.is-dragging {
  cursor: grabbing;
  transition: none;
}
.lb-loading {
  position: absolute;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e4e4e7;
  font-size: 12px;
  pointer-events: none;
}
.lb-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(24, 24, 27, 0.72);
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s;
}
.lb-nav-arrow:hover {
  background: rgba(255, 255, 255, 0.22);
}
.lb-nav-prev { left: 24px; }
.lb-nav-next { right: 24px; }

.lightbox-bottom {
  padding: 10px 22px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(20, 20, 23, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.lb-thumbs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 92vw;
  overflow-x: auto;
  padding: 2px 4px;
}
.lb-thumb-item {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 5px;
  border: 2px solid transparent;
  background: #f2f2f4;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.62;
  flex-shrink: 0;
  transition: opacity 0.12s, border-color 0.12s, transform 0.12s;
}
.lb-thumb-item:hover {
  opacity: 0.92;
}
.lb-thumb-item.active {
  opacity: 1;
  border-color: #ffffff;
  transform: translateY(-1px);
}
.lb-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lb-hint {
  font-size: 11px;
  color: #71717a;
}

@media (max-width: 860px) {
  .metrics-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-cell { border-bottom: 1px solid var(--line); }
  .breakdown-strip { grid-template-columns: 1fr; }
  .breakdown-col { border-right: none; border-bottom: 1px solid var(--line); }
  .breakdown-col:last-child { border-bottom: none; }
}

/* Sold-out & inline replacement styles in Collection Card & Sample Requisition Modal */
.cc-row-soldout {
  background: #fef2f2 !important;
}
.cc-row-lowstock {
  background: #fffbeb !important;
}
.cc-replace-panel {
  background: #f8fafc;
  border-top: 1px dashed var(--line);
  padding: 10px 14px !important;
}
.cc-replace-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cc-replace-results {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 6px;
}
.cc-rep-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: border-color 0.12s, background 0.12s;
}
.cc-rep-item:hover {
  border-color: var(--ink);
  background: #fafafa;
}
.sku-code-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: #f4f4f5;
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
}
.sku-code-chip:hover {
  border-color: var(--ink);
}

/* Smart Category Inline Trigger & Quick Picker Popover */
.cat-edit-trigger {
  margin-top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1.5px 6px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-2);
  background: #f4f4f5;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}
.cat-edit-trigger:hover {
  color: var(--ink);
  background: #ffffff;
  border-color: #bdbdc4;
}
.cat-edit-trigger.is-unresolved {
  color: #b45309;
  background: #fffbeb;
  border: 1px dashed #f59e0b;
}
.cat-src-tag {
  font-size: 9.5px;
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 600;
  line-height: 1.4;
}
.cat-src-tag.manual {
  background: #18181b;
  color: #ffffff;
}
.cat-src-tag.fixed {
  background: #eff6ff;
  color: #1d4ed8;
}
.cat-src-tag.vision {
  background: #f3e8ff;
  color: #6b21a8;
}

.cat-picker-popover {
  position: fixed;
  z-index: 120;
  width: 320px;
  background: var(--surface);
  border: 1px solid #d4d4d8;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.cat-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px 6px;
  border-bottom: 1px solid var(--line-soft);
}
.cat-picker-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.cat-picker-meta {
  padding: 6px 12px 2px;
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.45;
}
.cat-picker-grid {
  padding: 6px 10px 10px;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.cat-chip {
  border: 1px solid var(--line);
  background: #fafafa;
  color: var(--ink-2);
  border-radius: 5px;
  padding: 4px 9px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.cat-chip:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: #ffffff;
}
.cat-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
  font-weight: 600;
}
.cat-picker-foot {
  padding: 7px 12px;
  border-top: 1px solid var(--line-soft);
  background: #fafafa;
  display: flex;
  justify-content: flex-end;
}

/* Collection Membership Status Tags */
.col-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.col-tag.published {
  background: #ecfdf3;
  color: #027a48;
  border: 1px solid #abefc6;
}
.col-tag.draft {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.col-tag.none {
  background: #f4f4f5;
  color: #71717a;
  border: 1px solid #e4e4e7;
  font-weight: 500;
}
