:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1b1f23;
  background: #f4f6f8;
  line-height: 1.45;
}

* { box-sizing: border-box; }

body { margin: 0; }

button, input, select { font: inherit; }

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  background: #111827;
  color: white;
  cursor: pointer;
}

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

button.secondary {
  background: #e5e7eb;
  color: #111827;
}

button.danger {
  background: #b42318;
}

button.off {
  background: #4b5563;
}

button.small { padding: 8px 12px; }

input, select {
  width: 100%;
  border: 1px solid #cfd6dd;
  border-radius: 10px;
  padding: 12px 14px;
  background: white;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  font-weight: 600;
}

.hint {
  display: block;
  color: #7a828c;
  font-size: 0.82rem;
  font-weight: 400;
  margin-top: 4px;
}

.shell {
  width: min(1000px, calc(100% - 28px));
  margin: 28px auto;
}

.card {
  background: white;
  border: 1px solid #e2e7ec;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.login-card {
  max-width: 440px;
  margin: 70px auto;
}

.hidden { display: none !important; }

.topbar,
.item-heading,
.search-row,
.position-row,
.qty-controls,
.panel-title-row,
.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar,
.panel-title-row {
  justify-content: space-between;
}

.top-actions,
.item-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar { margin-bottom: 18px; }

.search-row input { flex: 1; }

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

.muted { color: #68707a; }

.status {
  min-height: 1.2em;
  color: #68707a;
  margin-bottom: 0;
}

.status.error { color: #b42318; }
.status.success { color: #166534; }

.results {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.result {
  width: 100%;
  text-align: left;
  background: #f8fafc;
  color: #111827;
  border: 1px solid #e5e7eb;
  padding: 12px 14px;
}

.result strong {
  display: block;
  margin-bottom: 3px;
}

.result span {
  color: #68707a;
  font-size: 0.94rem;
}

.item-heading {
  justify-content: space-between;
  align-items: flex-start;
}

.sku {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #68707a;
}

.total-box {
  min-width: 90px;
  text-align: center;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 9px 14px;
}

.total-box span {
  display: block;
  color: #68707a;
  font-size: 0.82rem;
}

.total-box strong {
  font-size: 1.55rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 12px;
  margin: 14px 0 22px;
}

.meta-grid dt { color: #68707a; }
.meta-grid dd { margin: 0; }

.section-heading {
  border-top: 1px solid #e5e7eb;
  padding-top: 16px;
}

.position-row {
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid #eef1f4;
}

.position-info strong {
  display: block;
}

.position-info span {
  color: #68707a;
  font-size: 0.9rem;
}

.position-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.light {
  background: #166534;
}

.qty {
  min-width: 56px;
  text-align: center;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.assign-box {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e5e7eb;
}

.assign-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 120px auto;
  gap: 10px;
}

@media (max-width: 700px) {
  .shell {
    width: min(100% - 18px, 1000px);
    margin: 10px auto;
  }

  .card { padding: 15px; }

  .topbar,
  .panel-title-row,
  .item-heading,
  .search-row,
  .position-row {
    align-items: stretch;
  }

  .topbar,
  .panel-title-row,
  .item-heading,
  .position-row {
    flex-direction: column;
  }

  .top-actions,
  .item-heading-actions {
    width: 100%;
  }

  .top-actions button,
  .item-heading-actions button {
    flex: 1;
  }

  .form-grid,
  .assign-grid {
    grid-template-columns: 1fr;
  }

  .position-actions {
    display: grid;
    grid-template-columns: auto auto auto;
  }

  .light,
  .off {
    grid-column: auto;
  }
}
