:root {
  --ink: #172126;
  --muted: #657178;
  --line: #cfd8dd;
  --soft-line: #e5ebee;
  --page: #eef2f4;
  --panel: #ffffff;
  --subtle: #f7f9fa;
  --green: #1f6b5f;
  --green-deep: #155149;
  --green-soft: #e7f2ef;
  --amber: #b97820;
  --amber-soft: #fff2d8;
  --red: #a7442e;
  --shadow: 0 8px 24px rgba(23, 33, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  color: var(--ink);
  background: var(--page);
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
}

.app-shell {
  padding: 18px;
}

.app-frame {
  display: grid;
  gap: 12px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 2fr);
  gap: 12px;
  align-items: stretch;
}

.brand-block,
.status-cell,
.sheet-panel,
.mini-panel,
.log-sidebar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand-block {
  display: grid;
  align-content: center;
  padding: 16px 18px;
}

.eyebrow,
.status-cell span,
.summary-item span,
.kpi-card span {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--muted);
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

.brand-block h1 {
  margin: 5px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.status-cell {
  display: grid;
  gap: 5px;
  min-height: 86px;
  padding: 13px 14px;
}

.status-cell strong,
.summary-item strong {
  font-size: 20px;
  line-height: 1.2;
}

.status-cell small,
.field small,
.empty,
td small,
.sheet-note {
  color: var(--muted);
}

.tab-strip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 4px;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  flex: 0 0 auto;
  min-width: 104px;
  height: 38px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  padding: 0 14px;
  color: var(--ink);
  background: #e2e8eb;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tab-button.active {
  color: #ffffff;
  border-color: var(--green);
  background: var(--green);
}

.sheet-panel {
  min-height: calc(100vh - 170px);
  padding: 18px;
  border-top-left-radius: 0;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: end;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--soft-line);
}

.section-heading h2 {
  margin: 3px 0 0;
  font-size: 24px;
}

.section-heading p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.compact {
  align-items: start;
}

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

.summary-item {
  display: grid;
  gap: 6px;
  min-height: 70px;
  padding: 12px 14px;
  border: 1px solid var(--soft-line);
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: var(--subtle);
}

.parameter-grid {
  display: grid;
  grid-template-columns: 0.95fr 0.9fr 1.4fr;
  gap: 12px;
}

.parameter-card {
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--subtle);
}

.parameter-card h3,
.mini-panel h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.parameter-list {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 5px;
}

.field span {
  font-size: 13px;
  font-weight: 800;
}

input {
  width: 100%;
  height: 34px;
  border: 1px solid #b8c6cb;
  border-radius: 6px;
  padding: 0 9px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
}

select {
  width: 100%;
  height: 34px;
  border: 1px solid #b8c6cb;
  border-radius: 6px;
  padding: 0 9px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
}

input:focus,
select:focus {
  outline: 2px solid rgba(31, 107, 95, 0.22);
  border-color: var(--green);
}

input:disabled {
  color: #748288;
  background: #edf1f3;
  cursor: not-allowed;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.cascade-table {
  margin-bottom: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--soft-line);
  border-right: 1px solid var(--soft-line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #eff4f5;
  color: var(--ink);
  font-weight: 850;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #ffffff;
  background: var(--green-deep);
}

tbody th {
  background: #f4f7f8;
}

.special-row td,
.special-row th {
  background: var(--amber-soft);
}

.attention-row td,
.attention-row th {
  background: #fff0ed;
}

.selected-row td,
.selected-row th {
  background: var(--green-soft);
}

.inline-info {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.info-dot {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #7a470b;
  background: #f3d28c;
  font-weight: 900;
}

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

.warehouse-detail-grid,
.split-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.mini-panel {
  padding: 14px;
}

.simple-table th {
  width: 42%;
}

.change-box {
  display: grid;
  gap: 10px;
}

.lock-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 9px 13px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

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

button.primary:hover,
.tab-button:hover {
  filter: brightness(0.97);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.locked-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #f0d099;
  border-radius: 6px;
  color: #7a470b;
  background: var(--amber-soft);
  font-weight: 850;
}

.status-alert,
.status-ready {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  font-weight: 850;
}

.status-alert {
  color: #8a2d1d;
  background: #ffd8d0;
}

.status-ready {
  color: var(--green-deep);
  background: var(--green-soft);
}

.log-sidebar {
  position: sticky;
  top: 16px;
  padding: 14px;
  max-height: calc(100vh - 176px);
  overflow: auto;
}

.log-list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.log-list li {
  padding: 11px;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  background: var(--subtle);
}

.log-list time,
.log-list small {
  color: var(--muted);
  font-size: 12px;
}

.log-list strong,
.log-list p {
  display: block;
  margin: 5px 0;
}

.emergency-table p {
  color: var(--muted);
  line-height: 1.55;
}

.impact-matrix {
  margin-top: 14px;
}

.impact-cell {
  min-width: 220px;
  color: #7a470b;
  background: var(--amber-soft);
  font-weight: 850;
  white-space: normal;
  line-height: 1.45;
}

.muted-cell {
  background: #f8fafb;
}

.selected-date {
  display: flex;
  align-items: end;
  gap: 14px;
  margin-bottom: 14px;
}

.inline-field {
  width: 220px;
}

.toolbar-row,
.filter-row {
  display: grid;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.toolbar-row {
  grid-template-columns: auto 1fr;
}

.filter-row {
  grid-template-columns: 140px 220px 160px 130px minmax(220px, 1fr);
}

.detail-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle);
}

.product-param-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.sheet-note {
  margin: 12px 0 0;
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(14px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 14px;
  border-radius: 6px;
  color: #ffffff;
  background: var(--red);
  box-shadow: var(--shadow);
  transition: 0.2s ease;
}

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

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell {
    padding: 10px;
  }

  .topbar,
  .status-strip,
  .summary-row,
  .parameter-grid,
  .warehouse-layout,
  .warehouse-detail-grid,
  .split-panels,
  .toolbar-row,
  .filter-row,
  .product-param-grid {
    grid-template-columns: 1fr;
  }

  .sheet-panel {
    min-height: auto;
    padding: 12px;
  }

  .section-heading {
    display: block;
  }

  .tab-button {
    min-width: 92px;
  }
}

/* Lifecycle 拥有品名和编码所有权，不可编辑 */
.readonly-name {
  display: inline-block;
  padding: 4px 8px;
  color: #555;
  font-size: 14px;
  line-height: 1.4;
}
