:root {
  --bg: #f3f6f5;
  --panel: #ffffff;
  --panel-strong: #f9fbfb;
  --text: #182422;
  --muted: #61716e;
  --line: #dce5e2;
  --line-strong: #c8d5d1;
  --green: #0f766e;
  --green-dark: #0b5f58;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 16px 40px rgba(28, 49, 44, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

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

.side-panel {
  background: #172421;
  color: #f6fbfa;
  padding: 22px;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #2dd4bf;
  color: #082f2b;
  font-weight: 800;
  font-size: 20px;
}

.brand-block h1,
.top-bar h2,
.section-head h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand-block h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand-block p,
.top-bar p,
.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.brand-block p {
  color: #b7c8c4;
  font-size: 12px;
}

.control-group {
  padding: 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
}

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

.group-title span {
  font-weight: 700;
  font-size: 14px;
}

.group-title small {
  color: #9fb1ad;
  font-size: 12px;
}

.file-drop {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 4px 10px;
  align-items: center;
  min-height: 84px;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.file-drop.compact {
  min-height: 70px;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-drop svg {
  grid-row: 1 / span 2;
  width: 22px;
  height: 22px;
  color: #5eead4;
}

.file-drop span {
  font-weight: 700;
  font-size: 13px;
}

.file-drop small {
  color: #a8bbb7;
  font-size: 12px;
}

.upload-progress {
  margin: 4px 0 12px;
  border: 1px solid rgba(94, 234, 212, 0.28);
  border-radius: 8px;
  background: rgba(45, 212, 191, 0.1);
  padding: 11px;
}

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

.progress-copy span {
  color: #d7e3e0;
  font-size: 12px;
  font-weight: 700;
}

.progress-copy strong {
  color: #5eead4;
  font-size: 13px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2dd4bf, #a7f3d0);
  transition: width 220ms ease;
}

.button-row,
.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button svg,
.secondary-button svg {
  width: 17px;
  height: 17px;
}

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

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

.secondary-button {
  background: rgba(255, 255, 255, 0.1);
  color: #f5fbfa;
  border-color: rgba(255, 255, 255, 0.14);
}

.main-panel .secondary-button {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.main-panel .secondary-button:hover {
  border-color: var(--line-strong);
}

.field-row,
.switch-row {
  display: grid;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.field-row {
  grid-template-columns: 1fr 86px 24px;
}

.field-row span,
.switch-row span {
  color: #d7e3e0;
  font-size: 13px;
}

.field-row em {
  color: #9fb1ad;
  font-size: 12px;
  font-style: normal;
}

.field-row input,
.side-panel textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 7px 9px;
}

.side-panel textarea {
  resize: vertical;
  line-height: 1.55;
}

.switch-row {
  grid-template-columns: 18px 1fr;
}

.switch-row input {
  accent-color: #2dd4bf;
}

.main-panel {
  min-width: 0;
  padding: 24px;
}

.top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.top-bar h2 {
  font-size: 26px;
}

.top-bar p,
.section-head p,
.urgent-head p {
  font-size: 13px;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(138px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 86px;
  box-shadow: var(--shadow);
}

.metric-card small {
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1;
}

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

.urgent-section {
  margin-bottom: 18px;
}

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

.urgent-section:has(.urgent-head) {
  border-color: #efc36b;
  background: #fffaf0;
}

.urgent-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.urgent-empty strong {
  color: var(--text);
  font-size: 18px;
}

.urgent-empty span {
  color: var(--muted);
  font-size: 13px;
}

.urgent-empty.good {
  border-color: #bde5d8;
  background: #f4fbf8;
}

.urgent-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid #f0d59b;
}

.urgent-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fde0dc;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.urgent-head h3 {
  margin: 9px 0 0;
  color: var(--red);
  font-size: 26px;
  letter-spacing: 0;
}

.urgent-head p {
  margin: 6px 0 0;
  color: #70532a;
}

.urgent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 12px;
  padding: 14px;
}

.urgent-card {
  border: 1px solid #f0d59b;
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

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

.urgent-card .sku-cell {
  grid-template-columns: 44px minmax(110px, 1fr);
}

.urgent-card .sku-thumb {
  width: 44px;
  height: 44px;
}

.urgent-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fff3d6;
  color: #8a5a0a;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

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

.urgent-numbers div {
  min-height: 70px;
  border: 1px solid #f2dfb7;
  border-radius: 7px;
  background: #fff8e8;
  padding: 9px;
}

.urgent-numbers small {
  display: block;
  color: #70532a;
  font-size: 12px;
  font-weight: 800;
}

.urgent-numbers strong {
  display: block;
  margin-top: 7px;
  color: var(--red);
  font-size: 19px;
  line-height: 1.12;
}

.urgent-warehouses {
  margin-top: 10px;
  border-top: 1px solid #f0d59b;
  padding-top: 10px;
}

.urgent-warehouses span {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.urgent-warehouses p {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

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

.report-section {
  margin-bottom: 18px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.section-head h3 {
  font-size: 18px;
}

.canvas-frame {
  padding: 16px;
  overflow: auto;
  background: var(--panel-strong);
  border-radius: 0 0 8px 8px;
}

#bossCanvas {
  display: block;
  width: min(100%, 900px);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 14px 0;
  overflow-x: auto;
}

.tab-button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.tab-button.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.table-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-toolbar select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

.table-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  max-height: 68vh;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef5f3;
  color: #31413e;
  font-size: 12px;
  letter-spacing: 0;
}

tbody tr:hover {
  background: #f7fbfa;
}

tbody tr.warning-row {
  background: #fff8e8;
}

tbody tr.warning-row:hover {
  background: #fff3d6;
}

.sku-cell {
  display: grid;
  grid-template-columns: 50px minmax(150px, 1fr);
  gap: 10px;
  align-items: center;
}

.sku-thumb {
  width: 50px;
  height: 50px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #edf2f0;
}

.sku-placeholder {
  display: grid;
  place-items: center;
  color: #75908a;
  font-size: 12px;
  font-weight: 800;
}

.sku-name {
  display: block;
  font-weight: 800;
  color: var(--text);
}

.sku-id {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.green {
  background: #d9f8f1;
  color: #0f6f64;
}

.pill.blue {
  background: #dceaff;
  color: #2452b8;
}

.pill.amber {
  background: #fff3d6;
  color: #8a5a0a;
}

.pill.red {
  background: #fde0dc;
  color: #a12a20;
}

.pill.gray {
  background: #e8eeee;
  color: #536561;
}

.num-strong {
  font-weight: 900;
  color: var(--green-dark);
}

.warn-text {
  color: var(--red);
  font-weight: 800;
}

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

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

  .side-panel {
    position: static;
  }

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

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

@media (max-width: 680px) {
  .main-panel,
  .side-panel {
    padding: 16px;
  }

  .top-bar,
  .section-head,
  .urgent-head,
  .urgent-empty {
    display: block;
  }

  .top-actions,
  .section-head button,
  .urgent-head button {
    margin-top: 12px;
  }

  .kpi-strip {
    grid-template-columns: 1fr;
  }

  .table-count {
    margin-left: 0;
  }

  .urgent-grid,
  .urgent-numbers {
    grid-template-columns: 1fr;
  }
}
